# Send csv file to influxdb using node-red

**URL:** <https://community.influxdata.com/t/send-csv-file-to-influxdb-using-node-red/14934>\
**Category:** Systems\
**Created:** [June 22, 2020, 10:41am UTC](https://community.influxdata.com/t/send-csv-file-to-influxdb-using-node-red/14934 "2020-06-22T10:41:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nitesh](https://avatars.discourse-cdn.com/v4/letter/n/8491ac/32.png) [@Nitesh](https://community.influxdata.com/u/Nitesh)\
**Post date:** [June 22, 2020, 10:41am UTC](https://community.influxdata.com/t/send-csv-file-to-influxdb-using-node-red/14934/1 "2020-06-22T10:41:42Z")

</div>

Hello,  
I have a csv file which look like this:

| Time | [2:0] | [2:1] | [2:2] | [2:3] | [2:4] | [2:5] | [2:6] | [2:7] | [coil\_id] |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| time | Ziehkraft\_IST | Ziehkraft\_IST\_INT | Ziehkraft\_IST\_LIN | Drehzahl-Istwert vom Regler | Strom-Istwert vom Regler | ISTWERT ZIEHGESCHW.GEGLAETET | ISTWERT ZIEHGESCHW.GEGLAETET | Ziehkraft\_IST\_V | coil\_id |
| sec | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| 14.07.2017 19:03:15.000000 | 303.818 | 0 | 0.760291 | 0.72338 | 144.676 | 0.723379 | 144.676 | 0.0303818 | nan |
| 14.07.2017 19:03:15.010000 | 303.818 | 0 | 0.760291 | 0.72338 | 144.676 | 0.723379 | 144.676 | 0.0303818 | 0 |
| 14.07.2017 19:03:15.020000 | 303.818 | 0 | 0.760291 | 0.72338 | 144.676 | 0.723379 | 144.676 | 0.0303818 | 0 |
| 14.07.2017 19:03:15.030000 | 303.818 | 0 | 0.760291 | 0.72338 | 144.676 | 0.723379 | 144.676 | 0.0303818 | 0 |
| 14.07.2017 19:03:15.040000 | 303.818 | 0 | 0.760291 | 0.72338 | 144.676 | 0.723379 | 144.676 | 0.0303818 | 0 |

I have created nodes in node-red to send the data in node-red which look like this:

 ![2020-06-22 12_21_34-Window](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/4/480a3cf48837e26a969c4db9b017d0cb4e7b2eb2.png)

here I am able to see the result in debug node but I am not able to write the correct json script in function node before sending to influxdb.

I use this script:

msg.payload = [  
msg.payload.csv  
def convertTime(s):  
try:  
dt = set.datetime.strptime(s, ‘%d.%m.%Y %H:%M:%S.%f’)  
return dt  
except:  
return None  
;  
,  
{  
tag:“COIL\_ID”  
}];  
return msg;

I am new to nodered and influxdb .Please let me know(json script) that how can I send my csv file with correct timestamp and a tag key.

your efforts will be appreciated.

---

<div class="post-metadata">

**Author:** ![FredCyr](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/fredcyr/32/14581_2.png) [@FredCyr](https://community.influxdata.com/u/FredCyr)\
**Post date:** [November 11, 2023, 2:48pm UTC](https://community.influxdata.com/t/send-csv-file-to-influxdb-using-node-red/14934/2 "2023-11-11T14:48:56Z")

</div>

Interested to do similar CSV to node red to influxdb.  
Did you find what was wrong?

---

<div class="post-metadata">

**Author:** ![Anaisdg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/anaisdg/32/6401_2.png) [@Anaisdg](https://community.influxdata.com/u/Anaisdg)\
**Post date:** [November 16, 2023, 7:50am UTC](https://community.influxdata.com/t/send-csv-file-to-influxdb-using-node-red/14934/3 "2023-11-16T07:50:07Z")

</div>

Hello @FredCyr,  
Welcome!  
The easiest would be to convert the data to unix timestamp.
