# I don't know how to collect data for excel so that the header appears

**URL:** <https://discourse.nodered.org/t/i-dont-know-how-to-collect-data-for-excel-so-that-the-header-appears/70596>\
**Category:** General\
**Tags:** function-node\
**Created:** [14 November 2022 16:44 UTC](https://discourse.nodered.org/t/i-dont-know-how-to-collect-data-for-excel-so-that-the-header-appears/70596 "2022-11-14T16:44:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![estagiario555](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@estagiario555](https://discourse.nodered.org/u/estagiario555)\
**Post date:** [14 November 2022 16:44 UTC](https://discourse.nodered.org/t/i-dont-know-how-to-collect-data-for-excel-so-that-the-header-appears/70596/1 "2022-11-14T16:44:10Z")

</div>

493 / 5.000

## Resultados de tradução

Hello, I'm trying to connect an opc ua to node red so that what is harvested from it goes to excel in the form of a spreadsheet with header and information. At first I was trying to do a test playing information before connecting with the opc ua, trying to do only the part where I put information and it throws it to excel but the information comes out in a disorderly way and without a header, the photos are below of what i did Sorry for the english, I'm using the translator

 ![Captura de tela 2022-11-14 133924](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/d/4d9f35315565b579509c201713501c290589c15d.png)  
 ![Captura de tela 2022-11-14 134055e](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/6/46ac6a6b9e7842ec8bb942ffa2b30c72d5726043.png)  
 ![Captura de tela 2022-11-14 134141d](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/f/0f1317774d98baccb892fd14da2b9dede543d807.png)  
 ![Captura de tela 2022-11-14 1340022](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/1/81c7bb79755fe09b0ead965e54b64e7aec015088.png)  
 ![Captura de tela 2022-11-14 1340273](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/8/b821a5ee77c14cbfcc07eb786fce24584bfd2a09.png)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [14 November 2022 19:00 UTC](https://discourse.nodered.org/t/i-dont-know-how-to-collect-data-for-excel-so-that-the-header-appears/70596/2 "2022-11-14T19:00:17Z")

</div>

HI,

maybe try it like this

```auto
[{"id":"204ed6bbfd6cf0cf","type":"inject","z":"27d4cd61f8c2d5ed","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"alfa\":\"abc\",\"beta\":\"def\"}","payloadType":"json","x":155,"y":465,"wires":[["c3c92da5ab35c8f6"]]},{"id":"c3c92da5ab35c8f6","type":"csv","z":"27d4cd61f8c2d5ed","name":"","sep":",","hdrin":"","hdrout":"once","multi":"one","ret":"\\n","temp":"alfa,beta","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":320,"y":465,"wires":[["b469713283c5c661"]]},{"id":"b469713283c5c661","type":"file","z":"27d4cd61f8c2d5ed","name":"","filename":"/tmp/foo.csv","filenameType":"str","appendNewline":false,"createDir":false,"overwriteFile":"false","encoding":"none","x":490,"y":465,"wires":[["8407a341dd4baefe"]]},{"id":"8407a341dd4baefe","type":"debug","z":"27d4cd61f8c2d5ed","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":675,"y":465,"wires":[]},{"id":"b67d539538ccbbcd","type":"inject","z":"27d4cd61f8c2d5ed","name":"reset","props":[{"p":"reset","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":160,"y":525,"wires":[["c3c92da5ab35c8f6"]]}]

```

The csv node is set to only send the headers once (until the reset is hit and then ir send it again - but you many not need that).

---

<div class="post-metadata">

**Author:** ![estagiario555](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@estagiario555](https://discourse.nodered.org/u/estagiario555)\
**Post date:** [15 November 2022 22:19 UTC](https://discourse.nodered.org/t/i-dont-know-how-to-collect-data-for-excel-so-that-the-header-appears/70596/3 "2022-11-15T22:19:56Z")

</div>

Where do I put this code you wrote?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [15 November 2022 22:21 UTC](https://discourse.nodered.org/t/i-dont-know-how-to-collect-data-for-excel-so-that-the-header-appears/70596/4 "2022-11-15T22:21:20Z")

</div>

It’s just an example. Copy it and import it to your workspace to see how I have set it up

---

<div class="post-metadata">

**Author:** ![estagiario555](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@estagiario555](https://discourse.nodered.org/u/estagiario555)\
**Post date:** [16 November 2022 09:52 UTC](https://discourse.nodered.org/t/i-dont-know-how-to-collect-data-for-excel-so-that-the-header-appears/70596/5 "2022-11-16T09:52:31Z")

</div>

Ok, thank u

---

<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:** [15 January 2023 09:52 UTC](https://discourse.nodered.org/t/i-dont-know-how-to-collect-data-for-excel-so-that-the-header-appears/70596/6 "2023-01-15T09:52:44Z")

</div>

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