# Export data to excel or csv

**URL:** <https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [April 24, 2024, 2:25pm UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363 "2024-04-24T14:25:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [April 24, 2024, 2:25pm UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/1 "2024-04-24T14:25:47Z")

</div>

I have put a dataSet on Parameters,  
and I would like export then on excel/CSV file.

```python
dataDS = self.view.params.pData #table.data

	system.dataset.exportExcel("test.xls",1, dataDS)

```

error:

```python
com.inductiveautomation.ignition.common.script.JythonExecException
Traceback (most recent call last):
  File "<function:runAction>", line 3, in runAction
TypeError: can't convert u'value' to com.inductiveautomation.ignition.common.Dataset

	caused by org.python.core.PyException
Traceback (most recent call last):
  File "<function:runAction>", line 3, in runAction
TypeError: can't convert u'value' to com.inductiveautomation.ignition.common.Dataset

Ignition v8.1.38 (b2024030513)
Java: Azul Systems, Inc. 17.0.9

```

First time I'am tryng to export data. someone can help ? 🤔

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [April 24, 2024, 2:34pm UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/2 "2024-04-24T14:34:35Z")

</div>

You are trying to export a string `value` to excel. The [exportExcel](https://docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-dataset/system-dataset-exportExcel) system function expects a dataset.

```python
headers = ['test']
data = [['value']]
dataDS = system.dataset.toDataSet(headers,data)
...

```

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [April 24, 2024, 2:53pm UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/3 "2024-04-24T14:53:14Z")

</div>

Thank you @dkhayes117

I do this script but I'am getting another error:

```python
	
	headers = []
	data = []
	DS = self.parent.parent.parent.getChild("CorpEvenement").props.params.Data
	for row in DS:
		if not headers:
			headers = row.keys()
		data.append([val for key,val in row.iteritems()])
		
	dataDS= system.dataset.toDataSet(headers,data)
	
	
	#dataDS = self.parent.parent.parent.getChild("CorpEvenement").props.params.Data #table.data

	system.dataset.exportExcel("test.xls",1, dataDS)

```

errror:

```python
com.inductiveautomation.ignition.common.script.JythonExecException
Traceback (most recent call last):
  File "<function:runAction>", line 16, in runAction
AttributeError: 'com.inductiveautomation.ignition.common.script.Imm' object has no attribute 'exportExcel'

	at org.python.core.Py.AttributeError(Py.java:176)
	at org.python.core.PyObject.noAttributeError(PyObject.java:965)
	at org.python.core.PyObject. __getattr__ (PyObject.java:959)
	at org.python.pycode._pyx1905.runAction$1(<function:runAction>:16)
	at org.python.pycode._pyx1905.call_function(<function:runAction>)
	at org.python.core.PyTableCode.call(PyTableCode.java:173)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:306)
	at org.python.core.PyFunction.function ___call__ (PyFunction.java:474)
	at org.python.core.PyFunction. __call__ (PyFunction.java:469)
	at org.python.core.PyFunction. __call__ (PyFunction.java:464)
	at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:847)
	at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:829)
	at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runFunction(ProjectScriptLifecycle.java:868)
	at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(ScriptManager.java:1010)
	at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(ProjectScriptLifecycle.java:950)
	at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:161)
	at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:98)
	at com.inductiveautomation.perspective.gateway.action.ScriptAction.runAction(ScriptAction.java:80)
	at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.lambda$call$0(ActionCollection.java:263)
	at com.inductiveautomation.perspective.gateway.api.LoggingContext.mdc(LoggingContext.java:54)
	at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.call(ActionCollection.java:252)
	at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.call(ActionCollection.java:221)
	at com.inductiveautomation.perspective.gateway.threading.BlockingTaskQueue$TaskWrapper.run(BlockingTaskQueue.java:154)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at com.inductiveautomation.perspective.gateway.threading.BlockingWork$BlockingWorkRunnable.run(BlockingWork.java:58)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.python.core.PyException
Traceback (most recent call last):
  File "<function:runAction>", line 16, in runAction
AttributeError: 'com.inductiveautomation.ignition.common.script.Imm' object has no attribute 'exportExcel'

	... 29 more

Ignition v8.1.38 (b2024030513)
Java: Azul Systems, Inc. 17.0.9

```

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [April 24, 2024, 2:57pm UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/4 "2024-04-24T14:57:15Z")

</div>

exportExcel() will not work in perspective. Use toExcel() instead.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [April 24, 2024, 2:57pm UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/5 "2024-04-24T14:57:57Z")

</div>

I missed the perspective tag ☹

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [April 24, 2024, 3:04pm UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/6 "2024-04-24T15:04:59Z")

</div>

I'am gatting the same error

```python
TypeError: can't convert 1 to com.inductiveautomation.ignition.common.Dataset

```

---

<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:** [April 24, 2024, 3:15pm UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/7 "2024-04-24T15:15:43Z")

</div>

toExcel has different parameters and return value.

Pause.  
Take a second.  
Use the autocomplete (Ctrl+Space).  
_Try_ to solve your own problems.

---

<div class="post-metadata">

**Author:** ![Miguel\_Villasenor\_Es](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miguel_villasenor_es/32/60416_2.png) [@Miguel\_Villasenor\_Es](https://forum.inductiveautomation.com/u/Miguel_Villasenor_Es)\
**Post date:** [April 24, 2024, 3:29pm UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/8 "2024-04-24T15:29:54Z")

</div>

WOW.............  
WHY WAS THIS HIDDEN FROM ME........

🥲

I will forever use this:

> [@paul-griffith](#):
>
> Use the autocomplete (Ctrl+Space).

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [May 8, 2024, 1:41pm UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/9 "2024-05-08T13:41:40Z")

</div>

hello @paul-griffith  
I used what you recomanded me but, it not work. But maybe I forgot something

this my dataset:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/3/f3e7c3c0b3085886d4591c1d5dd85fc5a532dabf.png)

scrip:

```python
DS = self.view.getChild("root").custom.DataStatusAlarmes
	headers = system.dataset.getColumnHeaders(DS)
	system.dataset.toExcel(headers, DS, "C:\\TESTE\\results1.xls")

```

I get this error:

```python
com.inductiveautomation.ignition.common.script.JythonExecException
Traceback (most recent call last):
  File "<function:runAction>", line 6, in runAction
TypeError: can't convert [u'62d04597-0f49-4930-80f5-2d302efa155f', u'prov:default:/tag:Sensor/Sensor7/F8:/alm: High Alarm', u'Sensor 7 High Alarm', Wed May 08 15:13:42 CEST 2024, 0, 3] to com.inductiveautomation.ignition.common.Dataset

	at org.python.core.Py.TypeError(Py.java:236)
	at org.python.core.Py.tojava(Py.java:568)
	at com.inductiveautomation.ignition.common.script.builtin.DatasetUtilities.lambda$toExcel$1(DatasetUtilities.java:1022)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
	at java.base/java.util.Iterator.forEachRemaining(Unknown Source)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline.toArray(Unknown Source)
	at com.inductiveautomation.ignition.common.script.builtin.DatasetUtilities.toExcel(DatasetUtilities.java:1022)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:190)
	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:208)
	at org.python.core.PyObject. __call__ (PyObject.java:494)
	at org.python.core.PyObject. __call__ (PyObject.java:498)
	at org.python.pycode._pyx1823.runAction$1(<function:runAction>:27)
	at org.python.pycode._pyx1823.call_function(<function:runAction>)
	at org.python.core.PyTableCode.call(PyTableCode.java:173)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:306)
	at org.python.core.PyFunction.function ___call__ (PyFunction.java:474)
	at org.python.core.PyFunction. __call__ (PyFunction.java:469)
	at org.python.core.PyFunction. __call__ (PyFunction.java:464)
	at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:846)
	at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:828)
	at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runFunction(ProjectScriptLifecycle.java:832)
	at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(ScriptManager.java:1009)
	at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(ProjectScriptLifecycle.java:897)
	at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:158)
	at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:97)
	at com.inductiveautomation.perspective.gateway.action.ScriptAction.runAction(ScriptAction.java:74)
	at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.lambda$call$0(ActionCollection.java:263)
	at com.inductiveautomation.perspective.gateway.api.LoggingContext.mdc(LoggingContext.java:54)
	at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.call(ActionCollection.java:252)
	at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.call(ActionCollection.java:221)
	at com.inductiveautomation.perspective.gateway.threading.BlockingTaskQueue$TaskWrapper.run(BlockingTaskQueue.java:154)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at com.inductiveautomation.perspective.gateway.threading.BlockingWork$BlockingWorkRunnable.run(BlockingWork.java:58)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.python.core.PyException
Traceback (most recent call last):
  File "<function:runAction>", line 6, in runAction
TypeError: can't convert [u'62d04597-0f49-4930-80f5-2d302efa155f', u'prov:default:/tag:Sensor/Sensor7/F8:/alm: High Alarm', u'Sensor 7 High Alarm', Wed May 08 15:13:42 CEST 2024, 0, 3] to com.inductiveautomation.ignition.common.Dataset

	... 46 more

Ignition v8.1.27 (b2023042509)
Java: Azul Systems, Inc. 11.0.18

```

I found solution using: `spreadsheet = system.dataset.dataSetToExcel(1, [DS])` and `system.file.writeFile(filePath, spreadsheet)`  
It work.

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [May 8, 2024, 1:55pm UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/10 "2024-05-08T13:55:00Z")

</div>

For a simple export to.csv and download this works onClick Event

```python
def runAction(self, event):

	
	component = self.getSibling("tblWorkRequest")

	# Convert the dataset to CSV
	csv = system.dataset.toCSV(component.props.data)
	
	# Initiate a file download
	system.perspective.download("solicitudesOT.csv", csv)

```

tblWorkRequest is the table name, use the hierarchy u need.

---

<div class="post-metadata">

**Author:** ![Jesse\_Dale\_Gimenez](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jesse_dale_gimenez/32/68763_2.png) [@Jesse\_Dale\_Gimenez](https://forum.inductiveautomation.com/u/Jesse_Dale_Gimenez)\
**Post date:** [April 21, 2025, 7:29am UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/11 "2025-04-21T07:29:53Z")

</div>

Hi Alejandro,

Yes this works.  
but when I open the CSV  
all the data points are concentrated in a 1 cell.

is there a way to fomat the csv before exporting to csv?

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [April 21, 2025, 8:20am UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/12 "2025-04-21T08:20:32Z")

</div>

Hello!

You may try:

```python
def runAction(self, event):
    component = self.getSibling("tblWorkRequest")
    
    # Convert the dataset to CSV using commas as delimiter
    csv = system.dataset.toCSV(component.props.data, 1)
    

    system.perspective.download("solicitudesOT.csv", csv)

```

---

<div class="post-metadata">

**Author:** ![Jesse\_Dale\_Gimenez](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jesse_dale_gimenez/32/68763_2.png) [@Jesse\_Dale\_Gimenez](https://forum.inductiveautomation.com/u/Jesse_Dale_Gimenez)\
**Post date:** [April 21, 2025, 8:39am UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/13 "2025-04-21T08:39:09Z")

</div>

Thanks Alejandro,

Do you have the link for the manual for this script function?

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [April 21, 2025, 8:40am UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/14 "2025-04-21T08:40:11Z")

</div>

No, I don´t have a Manual for this, you may research online.

---

<div class="post-metadata">

**Author:** ![Jesse\_Dale\_Gimenez](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jesse_dale_gimenez/32/68763_2.png) [@Jesse\_Dale\_Gimenez](https://forum.inductiveautomation.com/u/Jesse_Dale_Gimenez)\
**Post date:** [April 21, 2025, 8:40am UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/15 "2025-04-21T08:40:37Z")

</div>

it fixes the 1 concentratrated cell issue but it puts all table data in 1 row

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [April 21, 2025, 8:41am UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/16 "2025-04-21T08:41:23Z")

</div>

You may research online or in this forum.

try:

```python
def runAction(self, event):
    component = self.getSibling("tblWorkRequest")
    
 
    csv = system.dataset.toCSV(component.props.data, 1)
    
    # Encode as UTF-8 with proper line breaks
    csvBytes = csv.encode('utf-8')
    
 
    system.perspective.download("solicitudesOT.csv", csvBytes)

```

Cheers!

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [April 21, 2025, 8:52am UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/17 "2025-04-21T08:52:59Z")

</div>

```python
def runAction(self, event):
    component = self.getSibling("tblWorkRequest")
    
 
    csv = system.dataset.toCSV(component.props.data, 1)
    
    # Encode as UTF-8 with proper line breaks
    csvBytes = csv.encode('utf-8')
    
 
    system.perspective.download("solicitudesOT.csv", csvBytes)

```

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [April 21, 2025, 11:25am UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/18 "2025-04-21T11:25:28Z")

</div>

> [@Jesse\_Dale\_Gimenez](#):
>
> Do you have the link for the manual for this script function?

> **[system.dataset.toCSV | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-dataset/system-dataset-toCSV)**
>
> Formats the contents of a dataset as CSV (comma separated values), returning the resulting CSV as a string.

> **[system.perspective.download | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-perspective/system-perspective-download)**
>
> Downloads data from the Gateway to a device running a Session.

---

<div class="post-metadata">

**Author:** ![Vignesh\_Muniyasamy1](https://avatars.discourse-cdn.com/v4/letter/v/f08c70/32.png) [@Vignesh\_Muniyasamy1](https://forum.inductiveautomation.com/u/Vignesh_Muniyasamy1)\
**Post date:** [September 15, 2025, 3:08pm UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/19 "2025-09-15T15:08:21Z")

</div>

Hi Everyone,

I am facing some issues in system.perspective.toExcel function where I am getting the below error

at com.inductiveautomation.ignition.common.util.excel.adapters.DatasetExcelAdapter.drawSheet(DatasetExcelAdapter.java:61)

at com.inductiveautomation.ignition.common.util.excel.adapters.DatasetExcelAdapter.drawWorkbook(DatasetExcelAdapter.java:44)

at com.inductiveautomation.ignition.common.script.builtin.DatasetUtilities.dataSetToExcelBytes(DatasetUtilities.java:1217)

at com.inductiveautomation.ignition.common.script.builtin.DatasetUtilities.toExcel(DatasetUtilities.java:1031)

The same daatset can be converted into csv so data has no issues, i suspect something to do with excel formating.

Please suggest a way forward

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [September 15, 2025, 3:36pm UTC](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363/20 "2025-09-15T15:36:39Z")

</div>

To export to excel, for example a table you may use something like:

```python
	
			ds = self.getSibling("TablaDNF_0").custom.datatable
			
	
	
			
			# Convertir a Excel
			excelBytes = system.dataset.toExcel(True, [ds])
			
			# Descargar archivo
			system.perspective.download("kWh_GEN_ConsumoEdificiosINFRA.xls", excelBytes)

```

[Next page](https://forum.inductiveautomation.com/t/export-data-to-excel-or-csv/89363.md?page=2)
