# Custom naming excel sheets

**URL:** <https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961>\
**Category:** Ignition\
**Created:** [November 10, 2017, 3:19pm UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961 "2017-11-10T15:19:47Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr.K001](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Mr.K001](https://forum.inductiveautomation.com/u/Mr.K001)\
**Post date:** [November 10, 2017, 3:19pm UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/1 "2017-11-10T15:19:47Z")

</div>

Hey guys, hope all is well, I just figured out how to export different datasets to different worksheets in an excel file which is very exciting since I’d only have to do one export than 10 😃  
Now my only question would be: is there a way to name the excel worksheets? right now when I export it shows as dataset1 dataset2, It would be really great if I could name them individually when exporting the data.  
for anyone that want to know how to do the export you can just do the following:  
system.dataset.exportExcel(“Name.xls”,1,[table1.data,table2.data,table3.data])  
that will give you one excel file with 3 worksheets with your data.  
Thanks in advance!👍

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 10, 2017, 4:10pm UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/2 "2017-11-10T16:10:07Z")

</div>

This is not currently possible, but is a pretty good idea. I’ve filed an internal feature request so the developers can take a look at putting this into a future release.

---

<div class="post-metadata">

**Author:** ![Mr.K001](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Mr.K001](https://forum.inductiveautomation.com/u/Mr.K001)\
**Post date:** [November 10, 2017, 4:56pm UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/3 "2017-11-10T16:56:42Z")

</div>

Yes I agree, It would be a great addition to excel exporting especially when we are talking about saving time and resources and instead of having 10+ files you end up with one.

---

<div class="post-metadata">

**Author:** ![conlonj25](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@conlonj25](https://forum.inductiveautomation.com/u/conlonj25)\
**Post date:** [March 7, 2019, 10:06am UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/4 "2019-03-07T10:06:55Z")

</div>

Any progress on this front?

Alternatively, would anyone have a workaround?

---

<div class="post-metadata">

**Author:** ![Stevenson.Yuan](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@Stevenson.Yuan](https://forum.inductiveautomation.com/u/Stevenson.Yuan)\
**Post date:** [March 7, 2019, 4:18pm UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/5 "2019-03-07T16:18:42Z")

</div>

Bit of a work around

```auto
esp = event.source.parent
path = system.dataset.exportExcel("test",1,[esp.getComponent("Table").data,esp.getComponent("Table").data])

text = system.file.readFileAsString(path)
for i,sheetName in enumerate(["Sheet 1", "Sheet 2"]): # make up your sheetnames in a list
	text = text.replace("Dataset %s"%(i+1), sheetName)
	
system.file.writeFile(path, text)

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 7, 2019, 4:18pm UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/6 "2019-03-07T16:18:43Z")

</div>

You could use [`system.dataset.datasetToExcel`](https://docs.inductiveautomation.com/display/DOC79/system.dataset.dataSetToExcel) to format the dataset into an Excel-compatible string, then manipulate that string to rename the sheets.

---

<div class="post-metadata">

**Author:** ![jsorlie](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jsorlie/32/3645_2.png) [@jsorlie](https://forum.inductiveautomation.com/u/jsorlie)\
**Post date:** [April 1, 2019, 8:07pm UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/7 "2019-04-01T20:07:34Z")

</div>

@Stevenson.Yuan

Thanks this was really useful!

---

<div class="post-metadata">

**Author:** ![pascal](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@pascal](https://forum.inductiveautomation.com/u/pascal)\
**Post date:** [July 28, 2020, 1:22pm UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/8 "2020-07-28T13:22:11Z")

</div>

Hi, this function is no longer supported in Ignition 8.0.12.  
Instead there is the function **system.dataset.toExcel** but it returns a byte array and not a string.  
Is there any way to name the sheets using this function ?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 28, 2020, 3:49pm UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/9 "2020-07-28T15:49:14Z")

</div>

In (hopefully) 8.0.16, or possibly 8.0.17, `toExcel` is getting an additional parameter to allow you to directly supply worksheet names. The `datasetToExcel` function still exists and will still work, it’s just deprecated, since it returns non-compliant XML documents that “pretend” to be XLS files; `toExcel` returns “true” XLSX documents.

---

<div class="post-metadata">

**Author:** ![pascal](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@pascal](https://forum.inductiveautomation.com/u/pascal)\
**Post date:** [July 29, 2020, 6:45am UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/10 "2020-07-29T06:45:32Z")

</div>

Thanks for theses informations.  
I tried using `datasetToExcel` function and save the file in xlsx but it could not open so i guess it only works with xls files.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 30, 2020, 11:17pm UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/11 "2020-07-30T23:17:41Z")

</div>

Update: It made 8.0.16, so coming soon to a nightly/RC/final build, you’ll be able to provide worksheet names as a final parameter to `system.dataset.toExcel`.

---

<div class="post-metadata">

**Author:** ![vani161998](https://avatars.discourse-cdn.com/v4/letter/v/ee7513/32.png) [@vani161998](https://forum.inductiveautomation.com/u/vani161998)\
**Post date:** [December 15, 2022, 4:17am UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/12 "2022-12-15T04:17:17Z")

</div>

hi PGriffith,

Tried changing the sheet names using system.dataset.toExcel but still the sheet names are not dynamically changed.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 15, 2022, 12:32pm UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/13 "2022-12-15T12:32:39Z")

</div>

Show your code.

---

<div class="post-metadata">

**Author:** ![vani161998](https://avatars.discourse-cdn.com/v4/letter/v/ee7513/32.png) [@vani161998](https://forum.inductiveautomation.com/u/vani161998)\
**Post date:** [December 19, 2022, 5:17am UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/14 "2022-12-19T05:17:35Z")

</div>

datasetload = system.dataset.toDataSet(headers, load)  
`spreadsheet ` `=` `system.dataset.toExcel(` `True` `, [datasetload],['DATA SHEET'])`  
`filePath ` `=` `"C:\\results.xls"`  
`system.` `file` `.writeFile(filePath, spreadsheet)`

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 19, 2022, 12:57pm UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/15 "2022-12-19T12:57:49Z")

</div>

You are providing your list of sheet names to the `nullsEmpty` argument. Which makes `nullsEmpty` a `True`. You haven't provided your sheet names list to the argument for `sheetNames`.

In the docs: [system.dataset.toExcel()](https://docs.inductiveautomation.com/display/DOC81/system.dataset.toExcel)

---

<div class="post-metadata">

**Author:** ![Ryan\_Shaw](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@Ryan\_Shaw](https://forum.inductiveautomation.com/u/Ryan_Shaw)\
**Post date:** [June 3, 2025, 6:40pm UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/16 "2025-06-03T18:40:19Z")

</div>

pturmel is correct, using `system.dataset.toExcel(showHeaders, dataset, 1, sheetNames)` works.

Unfortunately, if using tab to auto-complete the function call in the designer, it will auto-complete as `system.dataset.toExcel(showHeaders, dataset, sheetNames)` and you won't realize you're passing in sheetNames to the nullsEmpty parameter. It also won't detect that a list of strings was passed in to a boolean parameter and self-correct the assignment. Something could be done about that by the IA team.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 3, 2025, 6:49pm UTC](https://forum.inductiveautomation.com/t/custom-naming-excel-sheets/15961/17 "2025-06-03T18:49:02Z")

</div>

> [@Ryan\_Shaw](#):
>
> Something could be done about that by the IA team.

No, python/jython very deliberately interprets empty collections as `False` and non-empty collections as `True` anywhere a boolean is expected. I would object to altering that behavior.
