# \[bug-15748\]system.dataset.toExcel doesn't allow multiple sheets

**URL:** <https://forum.inductiveautomation.com/t/bug-15748-system-dataset-toexcel-doesnt-allow-multiple-sheets/31110>\
**Category:** Ignition\
**Tags:** ignition80, vision\
**Created:** [January 7, 2020, 1:29pm UTC](https://forum.inductiveautomation.com/t/bug-15748-system-dataset-toexcel-doesnt-allow-multiple-sheets/31110 "2020-01-07T13:29:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![grietveld](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/grietveld/32/6984_2.png) [@grietveld](https://forum.inductiveautomation.com/u/grietveld)\
**Post date:** [January 7, 2020, 1:29pm UTC](https://forum.inductiveautomation.com/t/bug-15748-system-dataset-toexcel-doesnt-allow-multiple-sheets/31110/1 "2020-01-07T13:29:41Z")

</div>

Just updated my project to 8.0.7 to use the new toExcel function for some data export functions, and instead of putting a dataset on each sheet, it puts one sheet with one column called value as shown below. Was there anything else changed on this function that I may have missed? Or is this a bug due to the changes?

I was really hoping to avoid the mismatched file extension errors in excel by using the new function, but the old function works in the meanwhile still I guess.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/480af01d2b306201dec9bb5f0313b69f37942c47.png)

---

<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:** [January 7, 2020, 4:25pm UTC](https://forum.inductiveautomation.com/t/bug-15748-system-dataset-toexcel-doesnt-allow-multiple-sheets/31110/2 "2020-01-07T16:25:58Z")

</div>

How are you calling the script? It looks like maybe you’ve got an extra layer of lists of datasets being passed, or the function is coercing what you’re passing in to a single value somehow.

---

<div class="post-metadata">

**Author:** ![grietveld](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/grietveld/32/6984_2.png) [@grietveld](https://forum.inductiveautomation.com/u/grietveld)\
**Post date:** [January 7, 2020, 4:27pm UTC](https://forum.inductiveautomation.com/t/bug-15748-system-dataset-toexcel-doesnt-allow-multiple-sheets/31110/3 "2020-01-07T16:27:43Z")

</div>

Below is the bit of chaos that is the prep for that export. If I swap toExcel, for dataSetToExcel, it works and has data on separate sheets, but it throws the mismatched file type errors if I use that function.

```auto
data2 = system.db.runNamedQuery('Reports/KPI/St2',{'StartDate':startDate,'EndDate':endDate})
data5 = system.db.runNamedQuery('Reports/KPI/St5',{'StartDate':startDate,'EndDate':endDate})
data5B = system.db.runNamedQuery('Reports/KPI/St5B',{'StartDate':startDate,'EndDate':endDate})
data4 = system.db.runNamedQuery('Reports/KPI/St4',{'StartDate':startDate,'EndDate':endDate})
data6A = system.db.runNamedQuery('Reports/KPI/St6A',{'StartDate':startDate,'EndDate':endDate})
data6B = system.db.runNamedQuery('Reports/KPI/St6B','StartDate':startDate,'EndDate':endDate})
data7 = system.db.runNamedQuery('Reports/KPI/St7',{'StartDate':startDate,'EndDate':endDate})
data8 = system.db.runNamedQuery('Reports/KPI/St8',{'StartDate':startDate,'EndDate':endDate})
dataE = system.db.runNamedQuery('Reports/KPI/EOLT',{'StartDate':startDate,'EndDate':endDate})
data = [data2,data5,data5B,data4,data6A, data6B,data7,data8,dataE]
excel = system.dataset.toExcel(1, data,1)
path = system.file.saveFile("reportData.xls","xls", "Excel Workbook")
if path is not None:
   system.file.writeFile(path, excel)

```

---

<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:** [January 7, 2020, 4:33pm UTC](https://forum.inductiveautomation.com/t/bug-15748-system-dataset-toexcel-doesnt-allow-multiple-sheets/31110/4 "2020-01-07T16:33:56Z")

</div>

Whoops, I see the problem. Easy fix. I’ll get a bug ticket going.

---

<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 2, 2020, 7:23pm UTC](https://forum.inductiveautomation.com/t/bug-15748-system-dataset-toexcel-doesnt-allow-multiple-sheets/31110/5 "2020-03-02T19:23:02Z")

</div>

This issue is fixed in 8.0.10.
