Write data from 2 directions in different columns of csv file

Thanks, that was the reason.

We have all come to a decision.

I will add more information. My Excel is separated by ";" and not separated by a comma "," , so it didn't work for me. So division through ";".
function

msg.payload = msg.payload.node1 + ";" + msg.payload.node2;
return msg;

If you are writing to the excel file, I don't understand why the ; is the separator.

You can use just about anything to separate the values. Commas are used only as a default.

So I don't understand why you stated that Excel is separated by ; and not ,.

Yep not exactly a CSV file if it has Semi Colons !

Craig

Yes, but as the CSV node supports alternate separators, does it really matter?

That would be a SCSV. :grin:

2 Likes

In Europe we use ; to separate numbers in spreadsheets.
Because we use , in decimal numbers, where you use .
I write DKK 3,5, and you write DKK 3.5.

1 Like

and we still use , for thousands separator... eg 1,000,000.00 but CSV will use " to wrap values. So "1,000" or "DKK 3,5" is fine in a CSV

in the settings it is by default in excell. The comma didn't work for me. A ; semicolon works (there is a separation by columns)

I guess you have to use what works.

I'll throw off the code, maybe someone will need it. If the division by columns does not work for you, then put a function in the node instead of ; -->

[
    {
        "id": "d50d7dd210330e6a",
        "type": "join",
        "z": "9ee2cc1b247fc8f4",
        "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": 530,
        "y": 1780,
        "wires": [
            [
                "60fcd8185cc3fdb3",
                "bf89ee0167ff3cb6"
            ]
        ]
    },
    {
        "id": "967d0cd40dcda175",
        "type": "inject",
        "z": "9ee2cc1b247fc8f4",
        "name": "Inject 456",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "node2",
        "payload": "456",
        "payloadType": "num",
        "x": 280,
        "y": 1820,
        "wires": [
            [
                "d50d7dd210330e6a"
            ]
        ]
    },
    {
        "id": "c3c4f37a3d8af719",
        "type": "inject",
        "z": "9ee2cc1b247fc8f4",
        "name": "Inject 123",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "node1",
        "payload": "123",
        "payloadType": "num",
        "x": 280,
        "y": 1740,
        "wires": [
            [
                "d50d7dd210330e6a"
            ]
        ]
    },
    {
        "id": "60fcd8185cc3fdb3",
        "type": "debug",
        "z": "9ee2cc1b247fc8f4",
        "name": "Should be joined number",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 790,
        "y": 1780,
        "wires": []
    },
    {
        "id": "bf89ee0167ff3cb6",
        "type": "function",
        "z": "9ee2cc1b247fc8f4",
        "name": "function 1",
        "func": "msg.payload = msg.payload.node1 + \";\" + msg.payload.node2;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 700,
        "y": 1860,
        "wires": [
            [
                "9e2323ce686d5a96",
                "859511f099f1c91b"
            ]
        ]
    },
    {
        "id": "9e2323ce686d5a96",
        "type": "debug",
        "z": "9ee2cc1b247fc8f4",
        "name": "Shoudl be CSV",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 880,
        "y": 1920,
        "wires": []
    },
    {
        "id": "859511f099f1c91b",
        "type": "file",
        "z": "9ee2cc1b247fc8f4",
        "name": "test write",
        "filename": "/home/pi/test-csv",
        "appendNewline": true,
        "createDir": true,
        "overwriteFile": "false",
        "encoding": "none",
        "x": 680,
        "y": 1920,
        "wires": [
            []
        ]
    }
]

I launch the mechanism of import which is built in Excel. On the menu it «Data → Get External Data → From Text».

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