# CSV data to mysql using node red

**URL:** <https://discourse.nodered.org/t/csv-data-to-mysql-using-node-red/43179>\
**Category:** General\
**Created:** [25 March 2021 08:41 UTC](https://discourse.nodered.org/t/csv-data-to-mysql-using-node-red/43179 "2021-03-25T08:41:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kins](https://avatars.discourse-cdn.com/v4/letter/k/c67d28/32.png) [@Kins](https://discourse.nodered.org/u/Kins)\
**Post date:** [25 March 2021 08:41 UTC](https://discourse.nodered.org/t/csv-data-to-mysql-using-node-red/43179/1 "2021-03-25T08:41:47Z")

</div>

How do I insert csv data from an online file to mysql using node red?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [25 March 2021 09:00 UTC](https://discourse.nodered.org/t/csv-data-to-mysql-using-node-red/43179/2 "2021-03-25T09:00:17Z")

</div>

Hi.

Is this the same question [as your other post](https://discourse.nodered.org/t/how-do-i-read-text-file-from-amfi-website-and-insert-that-in-mysql/43166)? Please dont open multiple threads on the same issue - it just causes confusion.

> [@Kins](#):
>
> How do I insert csv data from an online file to mysql using node red?

Which part are you stuck on?

- getting the file?
- parsing the file?
- creating the SQL to perform an insert?

  

- Have you watched the [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6) playlist to get familiar with node-red?
- Have you been through the [cookbook](https://cookbook.nodered.org/) and tried the examples?

Show us what you have tried so far and tell us which point you are stuck on.

---

<div class="post-metadata">

**Author:** ![Kins](https://avatars.discourse-cdn.com/v4/letter/k/c67d28/32.png) [@Kins](https://discourse.nodered.org/u/Kins)\
**Post date:** [25 March 2021 09:03 UTC](https://discourse.nodered.org/t/csv-data-to-mysql-using-node-red/43179/3 "2021-03-25T09:03:34Z")

</div>

Hi steve, I'm stuck in inserting the csv file into mysql database. I'm able to get the csv file and parse it.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [25 March 2021 09:09 UTC](https://discourse.nodered.org/t/csv-data-to-mysql-using-node-red/43179/4 "2021-03-25T09:09:02Z")

</div>

Have you read the help on the [node-red-contrib-node-mysql](https://flows.nodered.org/node/node-red-node-mysql)? Look at the bit titled "Preparing Queries"

---

<div class="post-metadata">

**Author:** ![Kins](https://avatars.discourse-cdn.com/v4/letter/k/c67d28/32.png) [@Kins](https://discourse.nodered.org/u/Kins)\
**Post date:** [25 March 2021 09:19 UTC](https://discourse.nodered.org/t/csv-data-to-mysql-using-node-red/43179/5 "2021-03-25T09:19:19Z")

</div>

Yes I've read the documentation, my query is that I do not want hard coded values in msg.payload.  
I want to pass the values from my csv file directly to mysql database

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [25 March 2021 09:26 UTC](https://discourse.nodered.org/t/csv-data-to-mysql-using-node-red/43179/6 "2021-03-25T09:26:15Z")

</div>

> [@Kins](#):
>
> my query is that I do not want hard coded values in msg.payload.

Then dont use hard coded values. Use change nodes & function nodes & split nodes to move your data around until it meats the desired format as described on the mysql nodes readme.

TBH, I suspect (from your questions) that you lack certain node-red knowledge as what you are asking is pretty much base node-red functionality.

> [@Kins](#):
>
> I want to pass the values from my csv file directly to mysql database

If you cant figure that out from the info I have provided, then I recommend you go watch the play list i linked to earlier. Seriously, spend 1 hour - its worth it. Also try the cookbook examples out & read the forum posts (there are a few worked examples on CSV to mySQL)

In particular, read/watch this : how to use the debug panel to find the right path to any data item. [Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)

---

<div class="post-metadata">

**Author:** ![Kins](https://avatars.discourse-cdn.com/v4/letter/k/c67d28/32.png) [@Kins](https://discourse.nodered.org/u/Kins)\
**Post date:** [25 March 2021 09:30 UTC](https://discourse.nodered.org/t/csv-data-to-mysql-using-node-red/43179/7 "2021-03-25T09:30:39Z")

</div>

Yes Steve, I'm very much new to Node Red and I'm not able to figure out how to frame an insert statement for inserting my csv data to mysql database

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [24 May 2021 09:31 UTC](https://discourse.nodered.org/t/csv-data-to-mysql-using-node-red/43179/8 "2021-05-24T09:31:07Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
