# Need help in writing Multiple message outputs to a columns in single excel file

**URL:** <https://discourse.nodered.org/t/need-help-in-writing-multiple-message-outputs-to-a-columns-in-single-excel-file/17766>\
**Category:** General\
**Created:** [11 November 2019 02:26 UTC](https://discourse.nodered.org/t/need-help-in-writing-multiple-message-outputs-to-a-columns-in-single-excel-file/17766 "2019-11-11T02:26:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![farishsn](https://avatars.discourse-cdn.com/v4/letter/f/94ad74/32.png) [@farishsn](https://discourse.nodered.org/u/farishsn)\
**Post date:** [11 November 2019 02:26 UTC](https://discourse.nodered.org/t/need-help-in-writing-multiple-message-outputs-to-a-columns-in-single-excel-file/17766/1 "2019-11-11T02:26:37Z")

</div>

Hi guys  
Please help me to write multiple outputs to columns in an excel file. What I'm trying to do is get stock market data of a company and its changes with respect to time in to an excel file. I don't know how to write to an excel file in this case. please help me

I have attached screen shots and what is the output excel should look like.

1. How the excel columns should be and it will be populated every 2 seconds(Inject Node) (Which is the expected)
2. Screen shot of the flow  
 ![scrn](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/c/ca3bc0f596406f763517e5317b87f37d7cb38bc4.jpeg)

* * *

Code

```auto
[{"id":"4c253373.724e24","type":"tab","label":"MSQ","disabled":false,"info":""},{"id":"adb6dc9e.098ed","type":"inject","z":"4c253373.724e24","name":"make request","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"2","x":150,"y":480,"wires":[["99866b55.4604c","e42e41fc.3fee8","b8ed87.e74d6278"]]},{"id":"b8ed87.e74d6278","type":"http request","z":"4c253373.724e24","name":"BID/OFFER","method":"GET","ret":"txt","paytoqs":false,"url":"https://secure.icicidirect.com/IDirectTrading/trading/trading_stock_bestbid.aspx?Symbol=INFTEC","tls":"","proxy":"","authType":"","x":350,"y":140,"wires":[["379fc9a6.2fab46","8614e763.5ba96"]]},{"id":"fe5f466a.1e9e1","type":"debug","z":"4c253373.724e24","name":"Bid","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":770,"y":60,"wires":[]},{"id":"379fc9a6.2fab46","type":"html","z":"4c253373.724e24","name":"Total Bid Quantity","property":"","outproperty":"","tag":"tr.head:nth-child(8) > th:nth-child(2)","ret":"html","as":"single","x":550,"y":120,"wires":[["fe5f466a.1e9e1"]]},{"id":"8614e763.5ba96","type":"html","z":"4c253373.724e24","name":"Total Offer Quantity ","property":"payload","outproperty":"payload","tag":"tr.head:nth-child(9) > th:nth-child(2)","ret":"html","as":"single","x":550,"y":160,"wires":[["4642f996.5bebb"]]},{"id":"4642f996.5bebb","type":"debug","z":"4c253373.724e24","name":"Offer","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":770,"y":180,"wires":[]},{"id":"e42e41fc.3fee8","type":"http request","z":"4c253373.724e24","name":"LTP/CHANGE/LTT","method":"GET","ret":"txt","paytoqs":false,"url":"https://secure.icicidirect.com/IDirectTrading/Trading/trading_stock_quote.aspx?Symbol=INFTEC","tls":"","proxy":"","authType":"","x":330,"y":360,"wires":[["a7a47a6a.2c361","9bb4cba2.d56588","6c3606bc.9bb658","356f7d7d.f1eca2","a034a5d8.353f38","6a2ab19b.b8691","1307f8d3.b40aa7","19330be2.0b9ba4","cc40ec92.ce2cf8","13c398a8.0025df"]]},{"id":"a7a47a6a.2c361","type":"html","z":"4c253373.724e24","name":"LTP","property":"payload","outproperty":"payload","tag":"tr:nth-child(2) > td:nth-child(2)","ret":"text","as":"single","x":550,"y":340,"wires":[["c86fdc2a.8d1a7"]]},{"id":"c86fdc2a.8d1a7","type":"debug","z":"4c253373.724e24","name":"Last Traded Price","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":730,"y":320,"wires":[]},{"id":"9bb4cba2.d56588","type":"html","z":"4c253373.724e24","name":"% C","property":"payload","outproperty":"payload","tag":"tr:nth-child(9) > td:nth-child(2)","ret":"text","as":"single","x":550,"y":380,"wires":[["28b38a69.ae497e"]]},{"id":"6c3606bc.9bb658","type":"html","z":"4c253373.724e24","name":"C","property":"payload","outproperty":"payload","tag":"tr:nth-child(8) > td:nth-child(2)","ret":"text","as":"single","x":550,"y":420,"wires":[["e00d6b50.37cfd8"]]},{"id":"28b38a69.ae497e","type":"debug","z":"4c253373.724e24","name":"% Change","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":750,"y":360,"wires":[]},{"id":"e00d6b50.37cfd8","type":"debug","z":"4c253373.724e24","name":"Change","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":760,"y":400,"wires":[]},{"id":"356f7d7d.f1eca2","type":"html","z":"4c253373.724e24","name":" D C","property":"payload","outproperty":"payload","tag":"tr:nth-child(3) > td:nth-child(2)","ret":"text","as":"single","x":550,"y":460,"wires":[["37c99ad5.a460f6"]]},{"id":"a034a5d8.353f38","type":"html","z":"4c253373.724e24","name":"D O","property":"payload","outproperty":"payload","tag":"tr:nth-child(4) > td:nth-child(2)","ret":"text","as":"single","x":550,"y":500,"wires":[["e6f7aa1.8ba8ed8"]]},{"id":"37c99ad5.a460f6","type":"debug","z":"4c253373.724e24","name":"Day Close","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":750,"y":440,"wires":[]},{"id":"e6f7aa1.8ba8ed8","type":"debug","z":"4c253373.724e24","name":"Day Open","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":760,"y":480,"wires":[]},{"id":"f07823ef.cdccb","type":"debug","z":"4c253373.724e24","name":"Day High","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":760,"y":520,"wires":[]},{"id":"55797dd9.2a4c14","type":"debug","z":"4c253373.724e24","name":"Day Low","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":760,"y":560,"wires":[]},{"id":"6a2ab19b.b8691","type":"html","z":"4c253373.724e24","name":"D H","property":"payload","outproperty":"payload","tag":"tr:nth-child(5) > td:nth-child(2)","ret":"text","as":"single","x":550,"y":540,"wires":[["f07823ef.cdccb"]]},{"id":"1307f8d3.b40aa7","type":"html","z":"4c253373.724e24","name":"D L","property":"payload","outproperty":"payload","tag":"tr:nth-child(6) > td:nth-child(2)","ret":"text","as":"single","x":550,"y":580,"wires":[["55797dd9.2a4c14"]]},{"id":"cdd748c2.781738","type":"debug","z":"4c253373.724e24","name":"Time","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":770,"y":640,"wires":[]},{"id":"17413dba.7d3c7a","type":"debug","z":"4c253373.724e24","name":"Date","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":770,"y":600,"wires":[]},{"id":"19330be2.0b9ba4","type":"html","z":"4c253373.724e24","name":"Date","property":"payload","outproperty":"payload","tag":"tr:nth-child(2) > td:nth-child(4)","ret":"text","as":"single","x":550,"y":620,"wires":[["17413dba.7d3c7a"]]},{"id":"cc40ec92.ce2cf8","type":"html","z":"4c253373.724e24","name":"Time","property":"payload","outproperty":"payload","tag":"tr:nth-child(3) > td:nth-child(4)","ret":"text","as":"single","x":550,"y":660,"wires":[["cdd748c2.781738"]]},{"id":"13c398a8.0025df","type":"html","z":"4c253373.724e24","name":"BSEC","property":"payload","outproperty":"payload","tag":"tr:nth-child(13) > td:nth-child(1) > b:nth-child(1) > font:nth-child(2)","ret":"text","as":"single","x":550,"y":700,"wires":[["52d2e322.a24c04"]]},{"id":"52d2e322.a24c04","type":"debug","z":"4c253373.724e24","name":"BSE Change","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":750,"y":680,"wires":[]},{"id":"fa9cdb4a.b2338","type":"html","z":"4c253373.724e24","name":"BSE","property":"payload","outproperty":"payload","tag":"#sensTab1","ret":"text","as":"single","x":550,"y":760,"wires":[["5bf4bcd5.07798c"]]},{"id":"5bf4bcd5.07798c","type":"debug","z":"4c253373.724e24","name":"BSE ","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":770,"y":760,"wires":[]},{"id":"99866b55.4604c","type":"http request","z":"4c253373.724e24","name":"NSE/BSE","method":"GET","ret":"txt","paytoqs":false,"url":"https://money.rediff.com/index.html","tls":"","proxy":"","authType":"","x":340,"y":680,"wires":[["fa9cdb4a.b2338","36604ec2.6eee32"]]},{"id":"36604ec2.6eee32","type":"html","z":"4c253373.724e24","name":"NSE","property":"payload","outproperty":"payload","tag":"#sensTab2","ret":"text","as":"single","x":550,"y":800,"wires":[["efd785f8.a45268"]]},{"id":"efd785f8.a45268","type":"debug","z":"4c253373.724e24","name":"NSE","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":770,"y":800,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![JayDickson](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jaydickson/32/90592_2.png) [@JayDickson](https://discourse.nodered.org/u/JayDickson)\
**Post date:** [11 November 2019 03:10 UTC](https://discourse.nodered.org/t/need-help-in-writing-multiple-message-outputs-to-a-columns-in-single-excel-file/17766/2 "2019-11-11T03:10:10Z")

</div>

Due to their structure, adding columns to a CSV can be a pain in the backside. You pretty much have to read in the old file, split it up by rows, identify each row, and put the new column in each as appropriate, then recombine all of your objects to a new CSV to write to disk (or overwrite the original if you're feeling confident.)

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [11 November 2019 05:16 UTC](https://discourse.nodered.org/t/need-help-in-writing-multiple-message-outputs-to-a-columns-in-single-excel-file/17766/3 "2019-11-11T05:16:13Z")

</div>

If I understand correctly: every 2 seconds you want to write data into a csv file and you hope that excel will update this data while you have the file open ?

I don't think that works unless you use some specific excel plugin to stream data.  
And depending on the size of the data, 2 seconds might be too short to take all these actions.

However, you can not create an excel file in node red, create charts/calculations etc in the excel and add data from node red. csv is possible and can be read by excel, but xls is something different.

Did you consider using the dashboard with the table plugin ?
