# Send csv file to influxdb using node-red

**URL:** https://discourse.nodered.org/t/send-csv-file-to-influxdb-using-node-red/28868
**Category:** General
**Created:** [24 June 2020 07:25 UTC](https://discourse.nodered.org/t/send-csv-file-to-influxdb-using-node-red/28868 "2020-06-24T07:25:31Z")
**Posts on this page:** 1
**Showing post:** 15

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [24 June 2020 14:51 UTC](https://discourse.nodered.org/t/send-csv-file-to-influxdb-using-node-red/28868/15 "2020-06-24T14:51:57Z")

</div>

you need to build the the array of objects. I will give you an example of what I do. I have data coming into the function node that looks like this:

```auto
{
  "_event" : "node:9a8228ea.126e",
  "_msgid" : "f6d98534.55ecd8",
  "device" : "bme280",
  "location" : "geodome",
  "measurement" : "humidity",
  "mqtt" : "local",
  "node" : "node44",
  "payload" : 78.54,
  "qos" : 0,
  "retain" : false,
  "timestamp" : 1593010032187,
  "topic" : "wsremote/data/node44/bme280/humidity",
  "type" : "data"
}

```

I run it thru my `function` node which is this:

```auto
// create object and populate with Influx tags
var tags = {}
tags.node = msg.node
tags.device = msg.device
tags.location = msg.location

// create object for measurement values
var v = {}
v.value = msg.payload // the measurement value

// create and fill array for the payload
var arr = [] 
arr[0] = v // the measurement value
arr[1] = tags

// put the array into msg.payload and send it off
msg.payload = arr
return msg;

```

And this is what comes out (and I feed this to the `influx` node):

```auto
{
  "_event" : "node:9a8228ea.126e",
  "_msgid" : "f6d98534.55ecd8",
  "device" : "bme280",
  "location" : "geodome",
  "measurement" : "humidity",
  "mqtt" : "local",
  "node" : "node44",
  "payload" : [
    {
      "value" : 78.54
    },
    {
      "device" : "bme280",
      "location" : "geodome",
      "node" : "node44"
    }
  ],
  "qos" : 0,
  "retain" : false,
  "timestamp" : 1593010032187,
  "topic" : "wsremote/data/node44/bme280/humidity",
  "type" : "data"
}

```

---

_[View the full topic](https://discourse.nodered.org/t/send-csv-file-to-influxdb-using-node-red/28868)._
