# I want to generate excel file with Header

**URL:** <https://discourse.nodered.org/t/i-want-to-generate-excel-file-with-header/85210>\
**Category:** General\
**Created:** [5 February 2024 08:59 UTC](https://discourse.nodered.org/t/i-want-to-generate-excel-file-with-header/85210 "2024-02-05T08:59:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![PRABHAKAR82](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@PRABHAKAR82](https://discourse.nodered.org/u/PRABHAKAR82)\
**Post date:** [5 February 2024 08:59 UTC](https://discourse.nodered.org/t/i-want-to-generate-excel-file-with-header/85210/1 "2024-02-05T08:59:45Z")

</div>

Currently I generate excel file using MySQL database, but I want to add header on an excel sheet. Is it possible to add header?  
I attached the sample picture of what I want

 ![excel](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/c/cc8cc5207e1067265a85cdfa1abc3dc84daad45e.png)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [5 February 2024 11:55 UTC](https://discourse.nodered.org/t/i-want-to-generate-excel-file-with-header/85210/2 "2024-02-05T11:55:38Z")

</div>

> [@PRABHAKAR82](#):
>
> Currently I generate excel file using MySQL database

Can you explain how you do that please? A simple example flow would be useful.

---

<div class="post-metadata">

**Author:** ![PRABHAKAR82](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@PRABHAKAR82](https://discourse.nodered.org/u/PRABHAKAR82)\
**Post date:** [5 February 2024 13:04 UTC](https://discourse.nodered.org/t/i-want-to-generate-excel-file-with-header/85210/3 "2024-02-05T13:04:56Z")

</div>

```auto
[
    {
        "id": "85d23d3c7c2b9c49",
        "type": "excel",
        "z": "5b0c141e78dae949",
        "name": "",
        "file": "C:\\temp\\test.xlsx",
        "x": 830,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "511698bdc85a0825",
        "type": "mysql",
        "z": "5b0c141e78dae949",
        "mydb": "4290109d50355584",
        "name": "",
        "x": 650,
        "y": 200,
        "wires": [
            [
                "7ee0011e4002ec88",
                "eb0a02d5afe88ec6",
                "85d23d3c7c2b9c49"
            ]
        ]
    },
    {
        "id": "b723f34270f1847d",
        "type": "function",
        "z": "5b0c141e78dae949",
        "name": "select",
        "func": "var fromdate=msg.payload.From;\nvar todate = msg.payload.To;\nmsg.topic = \"SELECT * FROM `ems`.`m1` where DateTime between '\"+fromdate+\"' And '\"+todate+\"';\";\nreturn msg;\n",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 430,
        "y": 200,
        "wires": [
            [
                "511698bdc85a0825"
            ]
        ]
    },
    {
        "id": "a0f935a3a21d4a95",
        "type": "ui_form",
        "z": "5b0c141e78dae949",
        "name": "",
        "label": "",
        "group": "126d3db65e2e2039",
        "order": 1,
        "width": 7,
        "height": 1,
        "options": [
            {
                "label": "From",
                "value": "From",
                "type": "date",
                "required": true,
                "rows": null
            },
            {
                "label": "To",
                "value": "To",
                "type": "date",
                "required": true,
                "rows": null
            }
        ],
        "formValue": {
            "From": "",
            "To": ""
        },
        "payload": "",
        "submit": "Generate Report",
        "cancel": "cancel",
        "topic": "topic",
        "topicType": "msg",
        "splitLayout": true,
        "className": "",
        "x": 250,
        "y": 200,
        "wires": [
            [
                "b723f34270f1847d"
            ]
        ]
    },
    {
        "id": "4290109d50355584",
        "type": "MySQLdatabase",
        "name": "",
        "host": "127.0.0.1",
        "port": "3306",
        "db": "ems",
        "tz": "",
        "charset": "UTF8"
    },
    {
        "id": "126d3db65e2e2039",
        "type": "ui_group",
        "name": "Daily Report",
        "tab": "78f8e318a5983d02",
        "order": 2,
        "disp": true,
        "width": 7,
        "collapse": false,
        "className": ""
    },
    {
        "id": "78f8e318a5983d02",
        "type": "ui_tab",
        "name": "Report",
        "icon": "cloud_download",
        "order": 17,
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![PRABHAKAR82](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@PRABHAKAR82](https://discourse.nodered.org/u/PRABHAKAR82)\
**Post date:** [5 February 2024 13:05 UTC](https://discourse.nodered.org/t/i-want-to-generate-excel-file-with-header/85210/4 "2024-02-05T13:05:50Z")

</div>

but as see you in picture, I want to add header on excel

---

<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:** [5 February 2024 13:23 UTC](https://discourse.nodered.org/t/i-want-to-generate-excel-file-with-header/85210/5 "2024-02-05T13:23:48Z")

</div>

> [@PRABHAKAR82](#):
>
> `"type": "excel",`

If you want anyone to actually try your flow you will need to link to the exact **excel** node type ([there is more than one](https://flows.nodered.org/search?term=excel&type=node))

> [@PRABHAKAR82](#):
>
> `"type": "mysql",`

Also, when providing a demo flow, it is courteous to provide sample data (in an inject or change node) instead of a database node that will never work on the helpers node-red (since we dont have your data or access to it!)

---

<div class="post-metadata">

**Author:** ![PRABHAKAR82](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@PRABHAKAR82](https://discourse.nodered.org/u/PRABHAKAR82)\
**Post date:** [5 February 2024 13:28 UTC](https://discourse.nodered.org/t/i-want-to-generate-excel-file-with-header/85210/6 "2024-02-05T13:28:52Z")

</div>

Sorry for that I am using " node-red-contrib-excel" excel node

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [5 February 2024 13:42 UTC](https://discourse.nodered.org/t/i-want-to-generate-excel-file-with-header/85210/7 "2024-02-05T13:42:46Z")

</div>

> [@Steve-Mcl](#):
>
> > [@PRABHAKAR82](#):
> >
> > `"type": "mysql",`
> 
> Also, when providing a demo flow, it is courteous to provide sample data (in an inject or change node) instead of a database node that will never work on the helpers node-red (since we dont have your data or access to it!)

Basically Steve is saying if you want help provide data. Connect a `debug` node to the output of the `mysql` node and then copy the output and look at it and redact any confidential information.

Then put that data into an `inject` node and attach it to the node that process the output of the mysql node. Then test it to see it produces some result.

Finally export the flow from the `inject` node onward and provide that for someone to be able to run it.

---

<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:** [5 May 2024 13:43 UTC](https://discourse.nodered.org/t/i-want-to-generate-excel-file-with-header/85210/8 "2024-05-05T13:43:20Z")

</div>

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