# Problems with creating CSV or excel

**URL:** <https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041>\
**Category:** General\
**Created:** [22 January 2022 08:56 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041 "2022-01-22T08:56:34Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![BG6WCL](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@BG6WCL](https://discourse.nodered.org/u/BG6WCL)\
**Post date:** [22 January 2022 08:56 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/1 "2022-01-22T08:56:35Z")

</div>

Nice to be in this community！  
I can't append after using excelsheets to create excel, I can only cover;  
If multiple sheets cannot be created using CSV;  
I need to put the data of 2 devices into a file, each device corresponds to a piece of paper to record the data

```auto
[
    {
        "id": "81e91fe521078ee2",
        "type": "tab",
        "label": "临时测试",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "1502ffe3922a84f9",
        "type": "inject",
        "z": "81e91fe521078ee2",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 190,
        "y": 120,
        "wires": [
            [
                "6c5a46c348fb7688"
            ]
        ]
    },
    {
        "id": "94e8f4497d62d569",
        "type": "excelsheets",
        "z": "81e91fe521078ee2",
        "name": "",
        "file": "C:\\Users\\User\\Desktop\\888.xlsx",
        "x": 550,
        "y": 120,
        "wires": [
            []
        ]
    },
    {
        "id": "6c5a46c348fb7688",
        "type": "function",
        "z": "81e91fe521078ee2",
        "name": "",
        "func": "msg.payload= [\n {\n header: {\n col1: \"记录时间\",\n col2: \"温度\",\n col3: \"湿度\"\n } ,\n items: [\n {\n col1: \"2022\",\n col2: \"115\",\n col3: \"252\",\n \n }\n] ,\n sheetName: \"1号主机\"\n } ,\n {\n header: {\n col1: \"记录时间\",\n col2: \"温度\",\n col3: \"湿度\"\n } ,\n items: [\n {\n col1: \"2022\",\n col2: \"335\",\n col3: \"445\",\n }\n] ,\n sheetName: \"2号主机\"\n } ,\n // {header, items, sheetName} ,\n // {header, items, sheetName} ,\n // {header, items, sheetName} \n];\n// filepath: \"C:\\Users\\User\\Desktop\\output.xlsx\";\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 350,
        "y": 120,
        "wires": [
            [
                "94e8f4497d62d569"
            ]
        ]
    },
    {
        "id": "a94276757e1214c2",
        "type": "file",
        "z": "81e91fe521078ee2",
        "name": "csv test",
        "filename": "C:\\Users\\User\\Desktop\\999.csv",
        "appendNewline": true,
        "createDir": true,
        "overwriteFile": "false",
        "encoding": "GB2312",
        "x": 680,
        "y": 280,
        "wires": [
            [
                "9dc369d8e57ea079"
            ]
        ]
    },
    {
        "id": "9dc369d8e57ea079",
        "type": "debug",
        "z": "81e91fe521078ee2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 870,
        "y": 280,
        "wires": []
    },
    {
        "id": "7164e33d28b33439",
        "type": "function",
        "z": "81e91fe521078ee2",
        "name": "",
        "func": "// msg.paylad={}\ndelete msg.payload\nmsg.payload=[{\n\"记录时间\":10,\n \"温度\":0,\n \"湿度\":30\n},{\n\"记录时间\":10,\n \"温度\":0,\n \"湿度\":300\n},\n]\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 350,
        "y": 280,
        "wires": [
            [
                "2e5aa088cb9c8927",
                "43fa32cfd6566fa5"
            ]
        ]
    },
    {
        "id": "3fda573d886f428f",
        "type": "inject",
        "z": "81e91fe521078ee2",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 190,
        "y": 280,
        "wires": [
            [
                "7164e33d28b33439"
            ]
        ]
    },
    {
        "id": "2e5aa088cb9c8927",
        "type": "debug",
        "z": "81e91fe521078ee2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 370,
        "y": 220,
        "wires": []
    },
    {
        "id": "43fa32cfd6566fa5",
        "type": "csv",
        "z": "81e91fe521078ee2",
        "name": "js转CSV",
        "sep": ",",
        "hdrin": true,
        "hdrout": "once",
        "multi": "one",
        "ret": "\\r\\n",
        "temp": "记录时间,温度,湿度",
        "skip": "0",
        "strings": true,
        "include_empty_strings": "",
        "include_null_values": "",
        "x": 520,
        "y": 280,
        "wires": [
            [
                "a94276757e1214c2"
            ]
        ]
    },
    {
        "id": "738ce264cc595661",
        "type": "change",
        "z": "81e91fe521078ee2",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 360,
        "y": 420,
        "wires": [
            []
        ]
    }
]

```

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [22 January 2022 09:22 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/2 "2022-01-22T09:22:32Z")

</div>

Please use the below guide to post code in preformatted text, so that it is easy to copy your code.

![howtopastecode](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/4/f4456bb97585c0676e4bde6256ccd0dcb9484ac9.gif)

---

<div class="post-metadata">

**Author:** ![BG6WCL](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@BG6WCL](https://discourse.nodered.org/u/BG6WCL)\
**Post date:** [22 January 2022 09:27 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/3 "2022-01-22T09:27:22Z")

</div>

```auto
[
    {
        "id": "81e91fe521078ee2",
        "type": "tab",
        "label": "临时测试",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "1502ffe3922a84f9",
        "type": "inject",
        "z": "81e91fe521078ee2",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 190,
        "y": 120,
        "wires": [
            [
                "6c5a46c348fb7688"
            ]
        ]
    },
    {
        "id": "94e8f4497d62d569",
        "type": "excelsheets",
        "z": "81e91fe521078ee2",
        "name": "",
        "file": "C:\\Users\\User\\Desktop\\888.xlsx",
        "x": 550,
        "y": 120,
        "wires": [
            []
        ]
    },
    {
        "id": "6c5a46c348fb7688",
        "type": "function",
        "z": "81e91fe521078ee2",
        "name": "",
        "func": "msg.payload= [\n {\n header: {\n col1: \"记录时间\",\n col2: \"温度\",\n col3: \"湿度\"\n } ,\n items: [\n {\n col1: \"2022\",\n col2: \"115\",\n col3: \"252\",\n \n }\n] ,\n sheetName: \"1号主机\"\n } ,\n {\n header: {\n col1: \"记录时间\",\n col2: \"温度\",\n col3: \"湿度\"\n } ,\n items: [\n {\n col1: \"2022\",\n col2: \"335\",\n col3: \"445\",\n }\n] ,\n sheetName: \"2号主机\"\n } ,\n // {header, items, sheetName} ,\n // {header, items, sheetName} ,\n // {header, items, sheetName} \n];\n// filepath: \"C:\\Users\\User\\Desktop\\output.xlsx\";\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 350,
        "y": 120,
        "wires": [
            [
                "94e8f4497d62d569"
            ]
        ]
    },
    {
        "id": "a94276757e1214c2",
        "type": "file",
        "z": "81e91fe521078ee2",
        "name": "csv test",
        "filename": "C:\\Users\\User\\Desktop\\999.csv",
        "appendNewline": true,
        "createDir": true,
        "overwriteFile": "false",
        "encoding": "GB2312",
        "x": 680,
        "y": 280,
        "wires": [
            [
                "9dc369d8e57ea079"
            ]
        ]
    },
    {
        "id": "9dc369d8e57ea079",
        "type": "debug",
        "z": "81e91fe521078ee2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 870,
        "y": 280,
        "wires": []
    },
    {
        "id": "7164e33d28b33439",
        "type": "function",
        "z": "81e91fe521078ee2",
        "name": "",
        "func": "// msg.paylad={}\ndelete msg.payload\nmsg.payload=[{\n\"记录时间\":10,\n \"温度\":0,\n \"湿度\":30\n},{\n\"记录时间\":10,\n \"温度\":0,\n \"湿度\":300\n},\n]\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 350,
        "y": 280,
        "wires": [
            [
                "2e5aa088cb9c8927",
                "43fa32cfd6566fa5"
            ]
        ]
    },
    {
        "id": "3fda573d886f428f",
        "type": "inject",
        "z": "81e91fe521078ee2",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 190,
        "y": 280,
        "wires": [
            [
                "7164e33d28b33439"
            ]
        ]
    },
    {
        "id": "2e5aa088cb9c8927",
        "type": "debug",
        "z": "81e91fe521078ee2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 370,
        "y": 220,
        "wires": []
    },
    {
        "id": "43fa32cfd6566fa5",
        "type": "csv",
        "z": "81e91fe521078ee2",
        "name": "js转CSV",
        "sep": ",",
        "hdrin": true,
        "hdrout": "once",
        "multi": "one",
        "ret": "\\r\\n",
        "temp": "记录时间,温度,湿度",
        "skip": "0",
        "strings": true,
        "include_empty_strings": "",
        "include_null_values": "",
        "x": 520,
        "y": 280,
        "wires": [
            [
                "a94276757e1214c2"
            ]
        ]
    }
]

```

---

<div class="post-metadata">

**Author:** ![BG6WCL](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@BG6WCL](https://discourse.nodered.org/u/BG6WCL)\
**Post date:** [22 January 2022 09:31 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/4 "2022-01-22T09:31:37Z")

</div>

hi smanjunath211  
Can this be reproduced now? I am a novice  
thanks

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [22 January 2022 14:27 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/5 "2022-01-22T14:27:36Z")

</div>

> [@BG6WCL](#):
>
> `excelsheets`

Welcome to the forum.

It helps to provide a reference to specific nodes you might be using. In this case: [node-red-contrib-excelsheets (node) - Node-RED (nodered.org)](https://flows.nodered.org/node/node-red-contrib-excelsheets). (There are thousands of nodes now at it is often hard to know what people are using).

So can you confirm that you've successfully read the input workbook and you are getting the expected data payload?

Then perhaps you can explain what you are trying to add/change? And what is actually happening. As we don't have your original workbooks, it is hard to work out what is happening.

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [23 January 2022 01:08 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/6 "2022-01-23T01:08:45Z")

</div>

And I am sorry, I think Google translate is not at its best here, please confirm if I am reading your problem right.  
You are able to create an excel file (I did using your flow), but you don't know how to _append_ your file with new data. That is add new data at the end of file. I could not understand about CSV though. Are you saying you cannot have two worksheets in CSV, I think you are right. As far as I know CSV cannot have multiple worksheets.

---

<div class="post-metadata">

**Author:** ![BG6WCL](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@BG6WCL](https://discourse.nodered.org/u/BG6WCL)\
**Post date:** [23 January 2022 02:04 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/7 "2022-01-23T02:04:28Z")

</div>

hi smanjunat.  
Thank you for your reply, your understanding is correct, the current excel is unable to add data  
I need to append data in excel, and when I reinject the data before excel is overwritten

---

<div class="post-metadata">

**Author:** ![BG6WCL](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@BG6WCL](https://discourse.nodered.org/u/BG6WCL)\
**Post date:** [23 January 2022 02:06 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/8 "2022-01-23T02:06:08Z")

</div>

Think you reply. When I reinject the data before excel is overwritten

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [23 January 2022 03:59 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/9 "2022-01-23T03:59:52Z")

</div>

I did a little research and found this answer by @TotallyInformation who is also seeing this thread. may be he has some more inputs. sorry I could not help.

> [@Saving a JSON array in an excel file](https://discourse.nodered.org/t/saving-a-json-array-in-an-excel-file/1531/13):
>
> You will need to rearrange the JSON somewhat. Firstly, if you are using CSV, note that CSV files can only ever represent a single sheet. They have no concept of multiple sheets, you need multiple CSV files. You can use Excel to combine those files, especially if using newer versions of Excel. If your version of Excel has PowerQuery included then automatically combining a folder of CSV files into a single workbook is pretty easy. Even if not, it is relatively easy, especially with a bit of VBA f…

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [23 January 2022 11:22 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/10 "2022-01-23T11:22:52Z")

</div>

Unfortunately, this is a different node as far as I can tell from what has been shared.

The node doesn't have a lot of documentation so I think an issue will need to be raised in GitHub to find an answer. Or maybe use the excel node instead?

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [23 January 2022 13:07 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/11 "2022-01-23T13:07:31Z")

</div>

Can excel node create two sheets? He wants two separate worksheets to be updated for two inputs.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [23 January 2022 13:30 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/12 "2022-01-23T13:30:39Z")

</div>

There are a few node-red nodes for excel [on the flows library](https://flows.nodered.org/search?term=excel&type=node) (and there are even more if you use a [regular npm module](https://www.npmjs.com/search?q=excel) in a function node ([how to](https://nodered.org/docs/user-guide/writing-functions#loading-additional-modules))).

Here are the current node-red nodes listed in the library (as of writing)...

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

[excel nodes on flows library](https://flows.nodered.org/search?term=excel&type=node)

---

<div class="post-metadata">

**Author:** ![BG6WCL](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@BG6WCL](https://discourse.nodered.org/u/BG6WCL)\
**Post date:** [24 January 2022 13:36 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/13 "2022-01-24T13:36:04Z")

</div>

I have tried several ways but failed, can you help me  
thanks

```auto
[
    {
        "id": "81e91fe521078ee2",
        "type": "tab",
        "label": "临时测试",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "1502ffe3922a84f9",
        "type": "inject",
        "z": "81e91fe521078ee2",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 150,
        "y": 40,
        "wires": [
            [
                "6c5a46c348fb7688"
            ]
        ]
    },
    {
        "id": "94e8f4497d62d569",
        "type": "excelsheets",
        "z": "81e91fe521078ee2",
        "name": "",
        "file": "C:\\Users\\User\\Desktop\\888.xlsx",
        "x": 550,
        "y": 40,
        "wires": [
            []
        ]
    },
    {
        "id": "6c5a46c348fb7688",
        "type": "function",
        "z": "81e91fe521078ee2",
        "name": "",
        "func": "msg.payload= [\n {\n header: {\n col1: \"记录时间\",\n col2: \"温度\",\n col3: \"湿度\"\n } ,\n items: [\n {\n col1: \"2022\",\n col2: \"115\",\n col3: \"252\",\n \n }\n] ,\n sheetName: \"1号主机\"\n } ,\n {\n header: {\n col1: \"记录时间\",\n col2: \"温度\",\n col3: \"湿度\"\n } ,\n items: [\n {\n col1: \"2022\",\n col2: \"335\",\n col3: \"999\",\n }\n] ,\n sheetName: \"2号主机\"\n } ,\n // {header, items, sheetName} ,\n // {header, items, sheetName} ,\n // {header, items, sheetName} \n];\nfilepath: \"C:\\Users\\User\\Desktop\\output.xlsx\";\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 350,
        "y": 40,
        "wires": [
            [
                "94e8f4497d62d569"
            ]
        ]
    },
    {
        "id": "c9ed56984190b95d",
        "type": "comment",
        "z": "81e91fe521078ee2",
        "name": "When I repeat the injection, the previous data in execl is overwritten",
        "info": "",
        "x": 720,
        "y": 80,
        "wires": []
    },
    {
        "id": "b1a9abafe7a0dd64",
        "type": "excel",
        "z": "81e91fe521078ee2",
        "name": "excel",
        "file": "C:\\Users\\User\\Desktop\\666.xlsx",
        "x": 550,
        "y": 280,
        "wires": [
            []
        ]
    },
    {
        "id": "1a430109f61e57aa",
        "type": "xlsx-out",
        "z": "81e91fe521078ee2",
        "name": "xlsx-out",
        "sheetName": "test",
        "x": 740,
        "y": 540,
        "wires": [
            [
                "4b65ddf15b516640",
                "506e93ae9b6d2e57"
            ]
        ]
    },
    {
        "id": "876da1bea0183b7d",
        "type": "inject",
        "z": "81e91fe521078ee2",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 170,
        "y": 280,
        "wires": [
            [
                "f633ab87b184dec6"
            ]
        ]
    },
    {
        "id": "f0426b0398f4445f",
        "type": "debug",
        "z": "81e91fe521078ee2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 570,
        "y": 240,
        "wires": []
    },
    {
        "id": "f633ab87b184dec6",
        "type": "function",
        "z": "81e91fe521078ee2",
        "name": "",
        "func": "msg.payload= [\n {\n a:1,\n b:2,\n },\n // {\n // c:11,\n // d:22,\n // },\n];\n\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 370,
        "y": 280,
        "wires": [
            [
                "f0426b0398f4445f",
                "b1a9abafe7a0dd64"
            ]
        ]
    },
    {
        "id": "578a2d608e348863",
        "type": "comment",
        "z": "81e91fe521078ee2",
        "name": "When I repeat the injection, the previous data is overwritten and 2 sheets cannot be created",
        "info": "",
        "x": 810,
        "y": 320,
        "wires": []
    },
    {
        "id": "29e5774f88867339",
        "type": "function",
        "z": "81e91fe521078ee2",
        "name": "chiller01",
        "func": "msg.sheetName=\"chiller01\"\nmsg.payload=[\n {\n col1: \"记录时间\",\n col2: \"温度\",\n col3: \"湿度\"\n } ,\n {\n col1: \"2022\",\n col2: \"115\",\n col3: \"252\",\n }\n] \nmsg.fileName=\"C:\\Users\\User\\Desktop\\999.xlsx\"\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 340,
        "y": 540,
        "wires": [
            [
                "417ac20ebe3f2a86"
            ]
        ]
    },
    {
        "id": "cd42f86717242e4d",
        "type": "inject",
        "z": "81e91fe521078ee2",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 150,
        "y": 540,
        "wires": [
            [
                "29e5774f88867339"
            ]
        ]
    },
    {
        "id": "5b6c585b086827d7",
        "type": "function",
        "z": "81e91fe521078ee2",
        "name": "chiller02",
        "func": "msg.sheetName=\"chiller02\"\nmsg.payload= [5,6,7,8];\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 340,
        "y": 620,
        "wires": [
            [
                "417ac20ebe3f2a86"
            ]
        ]
    },
    {
        "id": "bf18c1beecb0f4d0",
        "type": "inject",
        "z": "81e91fe521078ee2",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 150,
        "y": 620,
        "wires": [
            [
                "5b6c585b086827d7"
            ]
        ]
    },
    {
        "id": "4b65ddf15b516640",
        "type": "file",
        "z": "81e91fe521078ee2",
        "name": "write file",
        "filename": "C:\\Users\\User\\Desktop\\999.xlsx",
        "appendNewline": false,
        "createDir": true,
        "overwriteFile": "false",
        "encoding": "GB2312",
        "x": 1020,
        "y": 540,
        "wires": [
            []
        ]
    },
    {
        "id": "417ac20ebe3f2a86",
        "type": "json",
        "z": "81e91fe521078ee2",
        "name": "",
        "property": "payload",
        "action": "str",
        "pretty": false,
        "x": 550,
        "y": 540,
        "wires": [
            [
                "1a430109f61e57aa",
                "e1161d883340cd51"
            ]
        ]
    },
    {
        "id": "e1161d883340cd51",
        "type": "debug",
        "z": "81e91fe521078ee2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 750,
        "y": 620,
        "wires": []
    },
    {
        "id": "506e93ae9b6d2e57",
        "type": "debug",
        "z": "81e91fe521078ee2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1030,
        "y": 620,
        "wires": []
    },
    {
        "id": "a6c56029eec82a09",
        "type": "comment",
        "z": "81e91fe521078ee2",
        "name": "I've tried several methods, but the output files are all corrupt; this node I can't get a reference to the example",
        "info": "",
        "x": 1060,
        "y": 500,
        "wires": []
    }
]

```

---

<div class="post-metadata">

**Author:** ![BG6WCL](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@BG6WCL](https://discourse.nodered.org/u/BG6WCL)\
**Post date:** [24 January 2022 13:41 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/14 "2022-01-24T13:41:15Z")

</div>

I'm from China, maybe due to the time difference I can't interact in time, hope someone can help me, I've been trying for a few days but still failed

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [24 January 2022 15:10 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/15 "2022-01-24T15:10:55Z")

</div>

> <https://github.com/mdkrieg/node-red-contrib-excelsheets/issues/5#issue-1111770934>
>
> How do we append the excel file already existing ?

have raised an issue and waiting for the author to respond.

sorry for tagging you @mdkrieg, if you could suggest if we can do this ?

---

<div class="post-metadata">

**Author:** ![BG6WCL](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@BG6WCL](https://discourse.nodered.org/u/BG6WCL)\
**Post date:** [24 January 2022 15:12 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/16 "2022-01-24T15:12:22Z")

</div>

I sorted out my needs, can anyone help me?

```auto
[
    {
        "id": "1502ffe3922a84f9",
        "type": "inject",
        "z": "81e91fe521078ee2",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 130,
        "y": 60,
        "wires": [
            [
                "6c5a46c348fb7688"
            ]
        ]
    },
    {
        "id": "94e8f4497d62d569",
        "type": "excelsheets",
        "z": "81e91fe521078ee2",
        "name": "",
        "file": "C:\\Users\\User\\Desktop\\output.xlsx",
        "x": 530,
        "y": 60,
        "wires": [
            []
        ]
    },
    {
        "id": "6c5a46c348fb7688",
        "type": "function",
        "z": "81e91fe521078ee2",
        "name": "",
        "func": "msg.payload= [\n {\n header: {\n col1: \"记录时间\",\n col2: \"温度\",\n col3: \"湿度\"\n } ,\n items: [\n {\n col1: \"2022\",\n col2: \"115\",\n col3: \"252\",\n \n }\n] ,\n sheetName: \"1号主机\"\n } ,\n {\n header: {\n col1: \"记录时间\",\n col2: \"温度\",\n col3: \"湿度\"\n } ,\n items: [\n {\n col1: \"2022\",\n col2: \"335\",\n col3: \"899\",\n }\n] ,\n sheetName: \"2号主机\"\n } ,\n // {header, items, sheetName} ,\n // {header, items, sheetName} ,\n // {header, items, sheetName} \n];\n// msg.filepath=\"C:\\Users\\User\\Desktop\\output.xlsx\";\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 60,
        "wires": [
            [
                "94e8f4497d62d569"
            ]
        ]
    },
    {
        "id": "c9ed56984190b95d",
        "type": "comment",
        "z": "81e91fe521078ee2",
        "name": "When I repeat the injection, the previous data in execl is overwritten",
        "info": "",
        "x": 700,
        "y": 100,
        "wires": []
    },
    {
        "id": "b1a9abafe7a0dd64",
        "type": "excel",
        "z": "81e91fe521078ee2",
        "name": "excel",
        "file": "C:\\Users\\User\\Desktop\\666.xlsx",
        "x": 510,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "1a430109f61e57aa",
        "type": "xlsx-out",
        "z": "81e91fe521078ee2",
        "name": "xlsx-out",
        "sheetName": "test",
        "x": 720,
        "y": 400,
        "wires": [
            [
                "4b65ddf15b516640",
                "506e93ae9b6d2e57"
            ]
        ]
    },
    {
        "id": "876da1bea0183b7d",
        "type": "inject",
        "z": "81e91fe521078ee2",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 130,
        "y": 220,
        "wires": [
            [
                "f633ab87b184dec6"
            ]
        ]
    },
    {
        "id": "f0426b0398f4445f",
        "type": "debug",
        "z": "81e91fe521078ee2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 530,
        "y": 180,
        "wires": []
    },
    {
        "id": "f633ab87b184dec6",
        "type": "function",
        "z": "81e91fe521078ee2",
        "name": "",
        "func": "msg.payload= [\n {\n \"gkj\":1,\n b:2,\n },\n // {\n // c:11,\n // d:22,\n // },\n];\n\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 220,
        "wires": [
            [
                "f0426b0398f4445f",
                "b1a9abafe7a0dd64"
            ]
        ]
    },
    {
        "id": "578a2d608e348863",
        "type": "comment",
        "z": "81e91fe521078ee2",
        "name": "When I repeat the injection, the previous data is overwritten and 2 sheets cannot be created",
        "info": "",
        "x": 770,
        "y": 260,
        "wires": []
    },
    {
        "id": "29e5774f88867339",
        "type": "function",
        "z": "81e91fe521078ee2",
        "name": "chiller01",
        "func": "msg.sheetName=\"chiller01\"\nmsg.payload=[\n {\n col1: \"记录时间\",\n col2: \"温度\",\n col3: \"湿度\"\n } ,\n {\n col1: \"2022\",\n col2: \"115\",\n col3: \"252\",\n }\n] \nmsg.fileName=\"C:\\Users\\User\\Desktop\\999.xlsx\"\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 320,
        "y": 400,
        "wires": [
            [
                "417ac20ebe3f2a86"
            ]
        ]
    },
    {
        "id": "cd42f86717242e4d",
        "type": "inject",
        "z": "81e91fe521078ee2",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 130,
        "y": 400,
        "wires": [
            [
                "29e5774f88867339"
            ]
        ]
    },
    {
        "id": "5b6c585b086827d7",
        "type": "function",
        "z": "81e91fe521078ee2",
        "name": "chiller02",
        "func": "msg.sheetName=\"chiller02\"\nmsg.payload= [5,6,7,8];\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 320,
        "y": 480,
        "wires": [
            [
                "417ac20ebe3f2a86"
            ]
        ]
    },
    {
        "id": "bf18c1beecb0f4d0",
        "type": "inject",
        "z": "81e91fe521078ee2",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 130,
        "y": 480,
        "wires": [
            [
                "5b6c585b086827d7"
            ]
        ]
    },
    {
        "id": "4b65ddf15b516640",
        "type": "file",
        "z": "81e91fe521078ee2",
        "name": "write file",
        "filename": "C:\\Users\\User\\Desktop\\999.xlsx",
        "appendNewline": false,
        "createDir": true,
        "overwriteFile": "false",
        "encoding": "GB2312",
        "x": 1000,
        "y": 400,
        "wires": [
            []
        ]
    },
    {
        "id": "417ac20ebe3f2a86",
        "type": "json",
        "z": "81e91fe521078ee2",
        "name": "",
        "property": "payload",
        "action": "str",
        "pretty": false,
        "x": 530,
        "y": 400,
        "wires": [
            [
                "1a430109f61e57aa",
                "e1161d883340cd51"
            ]
        ]
    },
    {
        "id": "e1161d883340cd51",
        "type": "debug",
        "z": "81e91fe521078ee2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 730,
        "y": 480,
        "wires": []
    },
    {
        "id": "506e93ae9b6d2e57",
        "type": "debug",
        "z": "81e91fe521078ee2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1010,
        "y": 480,
        "wires": []
    },
    {
        "id": "a6c56029eec82a09",
        "type": "comment",
        "z": "81e91fe521078ee2",
        "name": "I've tried several methods, but the output files are all corrupt; this node I can't get a reference to the example",
        "info": "",
        "x": 1000,
        "y": 360,
        "wires": []
    },
    {
        "id": "eaf7d50086a0b711",
        "type": "file",
        "z": "81e91fe521078ee2",
        "name": "jjjj",
        "filename": "C:\\Users\\User\\Desktop\\999.csv",
        "appendNewline": false,
        "createDir": true,
        "overwriteFile": "false",
        "encoding": "GB2312",
        "x": 610,
        "y": 640,
        "wires": [
            [
                "1560169b146af371"
            ]
        ]
    },
    {
        "id": "1560169b146af371",
        "type": "debug",
        "z": "81e91fe521078ee2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 770,
        "y": 640,
        "wires": []
    },
    {
        "id": "5735fa47723d9f39",
        "type": "function",
        "z": "81e91fe521078ee2",
        "name": "",
        "func": "msg.sheetname=\"chiller02\"\nmsg.payload={\n \n \"记录时间\":777,\n \"温 度\":888,\n//空格的格式必要要与后面的csv要保持一直，否则后面不识别数据\n \"湿 度\":9999,\n}\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 290,
        "y": 640,
        "wires": [
            [
                "ca6fba07024bc5a5"
            ]
        ]
    },
    {
        "id": "72f6a40c8099330e",
        "type": "inject",
        "z": "81e91fe521078ee2",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 130,
        "y": 640,
        "wires": [
            [
                "5735fa47723d9f39"
            ]
        ]
    },
    {
        "id": "ca6fba07024bc5a5",
        "type": "csv",
        "z": "81e91fe521078ee2",
        "name": "js转CSV",
        "sep": ",",
        "hdrin": true,
        "hdrout": "once",
        "multi": "mult",
        "ret": "\\r\\n",
        "temp": "记录时间,温 度,湿 度",
        "skip": "0",
        "strings": true,
        "include_empty_strings": "",
        "include_null_values": "",
        "x": 460,
        "y": 640,
        "wires": [
            [
                "eaf7d50086a0b711"
            ]
        ]
    },
    {
        "id": "d2aee75cfd5ca973",
        "type": "comment",
        "z": "81e91fe521078ee2",
        "name": "CSV has only one sheet and does not meet my needs",
        "info": "",
        "x": 920,
        "y": 600,
        "wires": []
    }
]

```

---

<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:** [25 March 2022 15:13 UTC](https://discourse.nodered.org/t/problems-with-creating-csv-or-excel/57041/17 "2022-03-25T15:13:21Z")

</div>

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