# Write data from 2 directions in different columns of csv file

**URL:** <https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450>\
**Category:** General\
**Created:** [22 July 2022 00:10 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450 "2022-07-22T00:10:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)\
**Post date:** [22 July 2022 00:10 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/1 "2022-07-22T00:10:26Z")

</div>

Hello. I want to write data from 2 directions in different columns of csv file. But my data was written in one column. I'm a little confused on this issue. and wanted to sort out this problem with you. I think this will be useful not only to me, but to all Node-red users. I have an example. Help with it.

```auto
[
    {
        "id": "3da047291d2d65d0",
        "type": "inject",
        "z": "9ee2cc1b247fc8f4",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "tip",
                "v": "01",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "11714368",
        "payloadType": "num",
        "x": 380,
        "y": 140,
        "wires": [
            [
                "5dd965fe633160aa",
                "511192c5688aa4dc"
            ]
        ]
    },
    {
        "id": "5dd965fe633160aa",
        "type": "debug",
        "z": "9ee2cc1b247fc8f4",
        "name": "02",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 610,
        "y": 120,
        "wires": []
    },
    {
        "id": "0110c7af1cacd1f2",
        "type": "debug",
        "z": "9ee2cc1b247fc8f4",
        "name": "03",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 850,
        "y": 180,
        "wires": []
    },
    {
        "id": "9f0c382eb88ecd7c",
        "type": "file",
        "z": "9ee2cc1b247fc8f4",
        "name": "",
        "filename": "C:\\Users\\aiovi\\Downloads\\Новая папка (2)\\control.csv",
        "appendNewline": true,
        "createDir": true,
        "overwriteFile": "false",
        "encoding": "utf8",
        "x": 1040,
        "y": 260,
        "wires": [
            []
        ]
    },
    {
        "id": "e2a2f2dab63dd049",
        "type": "inject",
        "z": "9ee2cc1b247fc8f4",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "tip",
                "v": "02",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "11999999",
        "payloadType": "num",
        "x": 380,
        "y": 240,
        "wires": [
            [
                "5dd965fe633160aa",
                "511192c5688aa4dc"
            ]
        ]
    },
    {
        "id": "89fe4c2a64df7480",
        "type": "debug",
        "z": "9ee2cc1b247fc8f4",
        "name": "01",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 710,
        "y": 300,
        "wires": []
    },
    {
        "id": "2266deadb6195e05",
        "type": "csv",
        "z": "9ee2cc1b247fc8f4",
        "name": "",
        "sep": ",",
        "hdrin": true,
        "hdrout": "none",
        "multi": "one",
        "ret": "\\r\\n",
        "temp": "01,02",
        "skip": "2",
        "strings": true,
        "include_empty_strings": false,
        "include_null_values": false,
        "x": 690,
        "y": 180,
        "wires": [
            [
                "9f0c382eb88ecd7c",
                "0110c7af1cacd1f2"
            ]
        ]
    },
    {
        "id": "511192c5688aa4dc",
        "type": "json",
        "z": "9ee2cc1b247fc8f4",
        "name": "",
        "property": "payload",
        "action": "str",
        "pretty": false,
        "x": 550,
        "y": 200,
        "wires": [
            [
                "2266deadb6195e05",
                "89fe4c2a64df7480"
            ]
        ]
    }
]

```

---

<div class="post-metadata">

**Author:** ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)\
**Post date:** [22 July 2022 00:13 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/2 "2022-07-22T00:13:28Z")

</div>

Uploading: 10.png...

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [22 July 2022 00:20 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/3 "2022-07-22T00:20:05Z")

</div>

Hi again.

Sorry, but I am not understanding **from 2 directions in different columns**.

I can sort of see that this is back to what we did last time, but I am not understanding what you want to do.

The flow you posted doesn't help (me) understand what it is you are wanting to do.

Both `inject` nodes send their message (different `payload`) and you get.... something - I'm guessing `msg.tip` which is important to you.

But I'm stuck.

Looking at the `CSV` node, you are _Skipping the first two lines_.  
If I'm not mistaken: with what you are sending into the node, you won't see an output.

I also think that the `CSV` node is not going to do what you want.  
Those messages are NOT in a CSV format.  
They are (I think) **objeccts**.

---

<div class="post-metadata">

**Author:** ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)\
**Post date:** [22 July 2022 00:29 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/4 "2022-07-22T00:29:23Z")

</div>

I need the data from the injection node #1 (11714368) to be written to the Data1 column, and the data from the injection node #2 (11999999 ) to be written to the Data2 column. Don't pay attention to (tip ) maybe this is not the right direction in solving the problem.  
 ![11](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/3/b3e33ee952e4aee65ae173fb848df65ab4f6d581.png)

 ![10](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/e/5ec8c601adf0818039cb94872b5dff8921144e4d.png)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [22 July 2022 00:32 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/5 "2022-07-22T00:32:46Z")

</div>

Ok....

But as much as that makes sense, it also doesn't.

As the data from `11714368` is always put in column 1 and the other in column 2 **(AND)** it is the numbers, it won't show anything useful - that I can see.

All you will have is a lot of lines where there is either the `11714368` in the first column or `11999999` in the second.

(By the way, the thread seems to be indicating that you are trying to upload a picture (`10.png`) and it is not working.)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [22 July 2022 00:37 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/6 "2022-07-22T00:37:55Z")

</div>

This **MAY** help you.

I'm not sure, because I am not really understanding what you are wanting to do.

But it may be a start.

```auto
[{"id":"511192c5688aa4dc","type":"json","z":"0918ee609bf69fc7","name":"","property":"payload","action":"str","pretty":false,"x":3760,"y":1810,"wires":[["2266deadb6195e05","89fe4c2a64df7480","04bf24eeafe703e9"]]},{"id":"3da047291d2d65d0","type":"inject","z":"0918ee609bf69fc7","name":"","props":[{"p":"payload"},{"p":"tip","v":"01","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"11714368","payloadType":"num","x":3590,"y":1750,"wires":[["5dd965fe633160aa","511192c5688aa4dc"]]},{"id":"e2a2f2dab63dd049","type":"inject","z":"0918ee609bf69fc7","name":"","props":[{"p":"payload"},{"p":"tip","v":"02","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"11999999","payloadType":"num","x":3590,"y":1850,"wires":[["5dd965fe633160aa","511192c5688aa4dc"]]},{"id":"2266deadb6195e05","type":"csv","z":"0918ee609bf69fc7","name":"","sep":",","hdrin":true,"hdrout":"none","multi":"mult","ret":"\\r\\n","temp":"01,02","skip":"0","strings":true,"include_empty_strings":false,"include_null_values":false,"x":3910,"y":1730,"wires":[["0110c7af1cacd1f2"]]},{"id":"89fe4c2a64df7480","type":"debug","z":"0918ee609bf69fc7","name":"01","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":3910,"y":1770,"wires":[]},{"id":"04bf24eeafe703e9","type":"function","z":"0918ee609bf69fc7","name":"","func":"let a = msg.payload;\nlet b = msg.tip;\nlet blank = ' ';\n\nif (msg.payload == 11714368)\n{\n msg.payload = a + \",\" + blank;\n} else\n{\n msg.payload = blank + \",\" + a;\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":3920,"y":1810,"wires":[["492b84570ca803d6","cac2e04a19d175d1"]]},{"id":"5dd965fe633160aa","type":"debug","z":"0918ee609bf69fc7","name":"02","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":3760,"y":1730,"wires":[]},{"id":"0110c7af1cacd1f2","type":"debug","z":"0918ee609bf69fc7","name":"03","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":4070,"y":1730,"wires":[]},{"id":"492b84570ca803d6","type":"debug","z":"0918ee609bf69fc7","name":"04","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":4070,"y":1770,"wires":[]},{"id":"cac2e04a19d175d1","type":"csv","z":"0918ee609bf69fc7","name":"name","sep":",","hdrin":true,"hdrout":"none","multi":"one","ret":"\\r\\n","temp":"01,02","skip":"0","strings":true,"include_empty_strings":true,"include_null_values":true,"x":4070,"y":1810,"wires":[["546cbe35362d422c"]]},{"id":"546cbe35362d422c","type":"debug","z":"0918ee609bf69fc7","name":"05","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":4230,"y":1810,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)\
**Post date:** [22 July 2022 00:40 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/7 "2022-07-22T00:40:41Z")

</div>

> [@Trying\_to\_learn](#):
>
> Ok....
> 
> But as much as that makes sense, it also doesn't.
> 
> As the data from `11714368` is always put in column 1 and the other in column 2 **(AND)** it is the numbers, it won't show anything useful - that I can see.
> 
> All you will have is a lot of lines where there is either the `11714368` in the first column or `11999999` in the second.
> 
> (By the way, the thread seems to be indicating that you are trying to upload a picture (`10.png`) and it is not working.)

While I was writing and translating the message, I will send the answer to the previous one. Instead of the data of the injection node No. 2 (11999999) and No. 1, there will be other given numbers and they will change. This is an example on which you need to understand how the method of outputting data from different inputs works and they are written in their own separate column in the csv file.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [22 July 2022 00:45 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/8 "2022-07-22T00:45:52Z")

</div>

But writing what you show will only log the numbers..... be it 11999999 or 11714368...

Those message (I'm guessing) have more things you want to save and so want to save that to your (CSV) file and have them in different columns to indicate from where the value came.  
(Fair enough)

The bit of code I posted should go a long way to helping you.  
You will just have to expand the lines to keep adding the other pieces of data to the payload.  
So if you hare wanting to get 4 pieces, you are going to have to expand on the lines to define stuff like:

`let c = msg.something_else`  
`let d = msg.another_thing`

and then expand the line/s:  
`msg.payload = blank + "," + a;`  
to be  
`msg.payload = blank + "," + a + "," + c + "," + d;`  
and so on.

# P.S.

I am not sure that putting the different values (from the different places) in different columns will be a good idea.

Why not have the first column indicating from where the reading came and (say) the second (and onwards) then being the values?

So the output could be something like:

```auto
A, 34, 18
B, 22, 20
B, 21, 11
B, 23, 16
A, 31, 19

```

And so on.

Just a thought.

If the program (spreadsheet?) needs them in different columns: no problem.

---

<div class="post-metadata">

**Author:** ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)\
**Post date:** [22 July 2022 00:50 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/9 "2022-07-22T00:50:45Z")

</div>

![12](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/3/038e1344d60caf910c2b6a05b50a34aa1cc65e3f.png)

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [22 July 2022 02:52 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/10 "2022-07-22T02:52:59Z")

</div>

OK what you are wanting to do is to take two pieces of incoming information (you have not told us where it comes from) - and then combine them together and write them to a file

Think of it like this

1. Data1 In
2. Data2 In
3. Combine Data1 and Data2 with a comma in between
4. Write the data out to your CSV file

A CSV file is just a plain text file with the values seperated by COMMAS as such Andrews program above to take the values and turn them into strings and then combine them into a single message with a Comma in the middle is perfectly valid - you can then just write to a text file and append the message at the end

The trick is that you have two different messages coming in - and as such you need to connect them together into a single message - have a look at the JOIN node for the magic sauce

Craig

---

<div class="post-metadata">

**Author:** ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)\
**Post date:** [22 July 2022 03:34 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/11 "2022-07-22T03:34:22Z")

</div>

[  
{  
"id": "9f0c382eb88ecd7c",  
"type": "file",  
"z": "9ee2cc1b247fc8f4",  
"name": "",  
"filename": "C:\Users\aiovi\Downloads\Новая папка (2)\control.csv",  
"appendNewline": true,  
"createDir": true,  
"overwriteFile": "false",  
"encoding": "utf8",  
"x": 860,  
"y": 540,  
"wires": [  
  
]  
},  
{  
"id": "dcae1299d62b8e40",  
"type": "inject",  
"z": "9ee2cc1b247fc8f4",  
"name": "11714368",  
"props": [  
{  
"p": "payload"  
},  
{  
"p": "topic",  
"vt": "str"  
}  
],  
"repeat": "",  
"crontab": "",  
"once": false,  
"onceDelay": 0.1,  
"topic": "1",  
"payload": "11714368",  
"payloadType": "num",  
"x": 300,  
"y": 420,  
"wires": [  
[  
"d569df18db756554",  
"ca182c1a81cefb4d"  
]  
]  
},  
{  
"id": "3fdc99796a485bb0",  
"type": "inject",  
"z": "9ee2cc1b247fc8f4",  
"name": "11999999",  
"props": [  
{  
"p": "payload"  
},  
{  
"p": "topic",  
"vt": "str"  
}  
],  
"repeat": "",  
"crontab": "",  
"once": false,  
"onceDelay": 0.1,  
"topic": "2",  
"payload": "11999999",  
"payloadType": "num",  
"x": 300,  
"y": 520,  
"wires": [  
[  
"d569df18db756554",  
"ca182c1a81cefb4d"  
]  
]  
},  
{  
"id": "f6cf2361c0f9000b",  
"type": "csv",  
"z": "9ee2cc1b247fc8f4",  
"name": "",  
"sep": ",",  
"hdrin": true,  
"hdrout": "none",  
"multi": "mult",  
"ret": "\r\n",  
"temp": "a,b",  
"skip": "1",  
"strings": true,  
"include\_empty\_strings": false,  
"include\_null\_values": false,  
"x": 670,  
"y": 460,  
"wires": [  
[  
"a9004335804d7ece",  
"9f0c382eb88ecd7c"  
]  
]  
},  
{  
"id": "d569df18db756554",  
"type": "debug",  
"z": "9ee2cc1b247fc8f4",  
"name": "02",  
"active": false,  
"tosidebar": true,  
"console": false,  
"tostatus": false,  
"complete": "true",  
"targetType": "full",  
"statusVal": "",  
"statusType": "auto",  
"x": 490,  
"y": 540,  
"wires":   
},  
{  
"id": "a9004335804d7ece",  
"type": "debug",  
"z": "9ee2cc1b247fc8f4",  
"name": "03",  
"active": true,  
"tosidebar": true,  
"console": false,  
"tostatus": false,  
"complete": "payload",  
"targetType": "msg",  
"statusVal": "",  
"statusType": "auto",  
"x": 830,  
"y": 460,  
"wires":   
},  
{  
"id": "ca182c1a81cefb4d",  
"type": "join",  
"z": "9ee2cc1b247fc8f4",  
"name": "",  
"mode": "custom",  
"build": "array",  
"property": "payload",  
"propertyType": "msg",  
"key": "topic",  
"joiner": "\n",  
"joinerType": "str",  
"accumulate": false,  
"timeout": "",  
"count": "2",  
"reduceRight": false,  
"reduceExp": "",  
"reduceInit": "",  
"reduceInitType": "",  
"reduceFixup": "",  
"x": 510,  
"y": 460,  
"wires": [  
[  
"f6cf2361c0f9000b"  
]  
]  
}  
Uploading: 13.png...  
Uploading: 14.png...

]  
that's what happened - it's not what I wanted

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [22 July 2022 03:38 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/12 "2022-07-22T03:38:22Z")

</div>

I dunno what you are doing in terms of uploading pictures - but it is not working

Also read the sticky on how to paste code

it needs to be between `` on a seperate line

```auto
Code Here

```

Just reading what you have posted it looks to me like you have done the join after the CSV node - you want to do it before the CSV node - and i would not use the CSV node i would use the file write node and Andrews progra snippet that he posted

> [@Trying\_to\_learn](#):
>
> `let c = msg.something_else`  
> `let d = msg.another_thing`
> 
> and then expand the line/s:  
> `msg.payload = blank + "," + a;`  
> to be  
> `msg.payload = blank + "," + a + "," + c + "," + d;`  
> and so on.

Craig

---

<div class="post-metadata">

**Author:** ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)\
**Post date:** [22 July 2022 03:46 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/13 "2022-07-22T03:46:46Z")

</div>

```auto
[
    {
        "id": "9f0c382eb88ecd7c",
        "type": "file",
        "z": "9ee2cc1b247fc8f4",
        "name": "",
        "filename": "C:\\Users\\aiovi\\Downloads\\Новая папка (2)\\control.csv",
        "appendNewline": true,
        "createDir": true,
        "overwriteFile": "false",
        "encoding": "utf8",
        "x": 900,
        "y": 540,
        "wires": [
            []
        ]
    },
    {
        "id": "dcae1299d62b8e40",
        "type": "inject",
        "z": "9ee2cc1b247fc8f4",
        "name": "11714368",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "1",
        "payload": "11714368",
        "payloadType": "num",
        "x": 300,
        "y": 420,
        "wires": [
            [
                "d569df18db756554",
                "ca182c1a81cefb4d"
            ]
        ]
    },
    {
        "id": "3fdc99796a485bb0",
        "type": "inject",
        "z": "9ee2cc1b247fc8f4",
        "name": "11999999",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "2",
        "payload": "11999999",
        "payloadType": "num",
        "x": 300,
        "y": 520,
        "wires": [
            [
                "d569df18db756554",
                "ca182c1a81cefb4d"
            ]
        ]
    },
    {
        "id": "f6cf2361c0f9000b",
        "type": "csv",
        "z": "9ee2cc1b247fc8f4",
        "name": "",
        "sep": ",",
        "hdrin": true,
        "hdrout": "none",
        "multi": "mult",
        "ret": "\\r\\n",
        "temp": "a,b",
        "skip": "1",
        "strings": true,
        "include_empty_strings": false,
        "include_null_values": false,
        "x": 670,
        "y": 460,
        "wires": [
            [
                "a9004335804d7ece",
                "9f0c382eb88ecd7c"
            ]
        ]
    },
    {
        "id": "d569df18db756554",
        "type": "debug",
        "z": "9ee2cc1b247fc8f4",
        "name": "02",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 530,
        "y": 540,
        "wires": []
    },
    {
        "id": "a9004335804d7ece",
        "type": "debug",
        "z": "9ee2cc1b247fc8f4",
        "name": "03",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 830,
        "y": 460,
        "wires": []
    },
    {
        "id": "ca182c1a81cefb4d",
        "type": "join",
        "z": "9ee2cc1b247fc8f4",
        "name": "",
        "mode": "custom",
        "build": "array",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "2",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 510,
        "y": 460,
        "wires": [
            [
                "f6cf2361c0f9000b"
            ]
        ]
    }
]

```

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [22 July 2022 03:47 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/14 "2022-07-22T03:47:18Z")

</div>

Try this

```auto
[{"id":"f71140d8e13ce0a4","type":"join","z":"295a96171a24b772","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":930,"y":340,"wires":[["86226a157c5104aa","13380805a2092327"]]},{"id":"77b47f7f5b3dfcb4","type":"inject","z":"295a96171a24b772","name":"Inject 456","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"node2","payload":"456","payloadType":"num","x":680,"y":380,"wires":[["f71140d8e13ce0a4"]]},{"id":"3a238434f591120e","type":"inject","z":"295a96171a24b772","name":"Inject 123","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"node1","payload":"123","payloadType":"num","x":680,"y":300,"wires":[["f71140d8e13ce0a4"]]},{"id":"86226a157c5104aa","type":"debug","z":"295a96171a24b772","name":"Should be joined number","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1190,"y":340,"wires":[]},{"id":"13380805a2092327","type":"function","z":"295a96171a24b772","name":"function 1","func":"msg.payload = msg.payload.node1 + \",\" + msg.payload.node2;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1100,"y":420,"wires":[["543a6fc9ab80b6d0"]]},{"id":"543a6fc9ab80b6d0","type":"debug","z":"295a96171a24b772","name":"Shoudl be CSV","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1220,"y":460,"wires":[]}]

```

Craig

---

<div class="post-metadata">

**Author:** ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)\
**Post date:** [22 July 2022 03:47 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/15 "2022-07-22T03:47:59Z")

</div>

```auto
{"_msgid":"f301807b0e920c27","payload":11999999,"topic":"2"}
{"_msgid":"73699768d815a9b1","payload":11714368,"topic":"1"}
11999999,11714368

```

---

<div class="post-metadata">

**Author:** ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)\
**Post date:** [22 July 2022 03:50 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/16 "2022-07-22T03:50:43Z")

</div>

сайт не грузит картинки. В общем получаю 11714368,1199999 в одной ячейке csv, а мне надо в разных. Я не программист. Не знаю как написать код.

---

<div class="post-metadata">

**Author:** ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)\
**Post date:** [22 July 2022 03:57 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/17 "2022-07-22T03:57:46Z")

</div>

попробовал, в строке exell получаю

```auto
22.07.2022, 12:55:16node: Shoudl be CSV
node2 : msg.payload : array[0]
[empty]

```

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [22 July 2022 03:59 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/18 "2022-07-22T03:59:13Z")

</div>

I have no idea what that Russian ? is meant to mean ?

here is the complete flow to write out to a file as well

```auto
[{"id":"f71140d8e13ce0a4","type":"join","z":"295a96171a24b772","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":930,"y":340,"wires":[["86226a157c5104aa","13380805a2092327"]]},{"id":"77b47f7f5b3dfcb4","type":"inject","z":"295a96171a24b772","name":"Inject 456","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"node2","payload":"456","payloadType":"num","x":680,"y":380,"wires":[["f71140d8e13ce0a4"]]},{"id":"3a238434f591120e","type":"inject","z":"295a96171a24b772","name":"Inject 123","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"node1","payload":"123","payloadType":"num","x":680,"y":300,"wires":[["f71140d8e13ce0a4"]]},{"id":"86226a157c5104aa","type":"debug","z":"295a96171a24b772","name":"Should be joined number","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1190,"y":340,"wires":[]},{"id":"13380805a2092327","type":"function","z":"295a96171a24b772","name":"function 1","func":"msg.payload = msg.payload.node1 + \",\" + msg.payload.node2;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1100,"y":420,"wires":[["543a6fc9ab80b6d0","1015555dba5d1c64"]]},{"id":"543a6fc9ab80b6d0","type":"debug","z":"295a96171a24b772","name":"Shoudl be CSV","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1280,"y":480,"wires":[]},{"id":"1015555dba5d1c64","type":"file","z":"295a96171a24b772","name":"test write","filename":"/home/pi/test-csv","filenameType":"str","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":1080,"y":480,"wires":[[]]}]

```

---

<div class="post-metadata">

**Author:** ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)\
**Post date:** [22 July 2022 04:10 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/19 "2022-07-22T04:10:18Z")

</div>

i get 123,456 in one cell  
and I need 123 to be in 1 cell (A2), 456 in another (B2). And on top was if it's easy heading. Okay, this is a long story...

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [22 July 2022 04:28 UTC](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450/20 "2022-07-22T04:28:12Z")

</div>

What are you using to read that file ? If you open it in excel (for example) you can tell it to use the values in each cell not to treat them as a string

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/6/86fe5470745d6d39f5a4b77c0047d1065dea8e06.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/4/a46a946d4f40502c32e06028f0a440405f4e4f10.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/b/bb076570eeea51fbfaef7b26bae4663a432e6351.png)

[Next page](https://discourse.nodered.org/t/write-data-from-2-directions-in-different-columns-of-csv-file/65450.md?page=2)
