# Export dataset to excel with particular cell in vision

**URL:** <https://forum.inductiveautomation.com/t/export-dataset-to-excel-with-particular-cell-in-vision/73641>\
**Category:** Ignition\
**Tags:** vision, ignition81, scripting, database\
**Created:** [May 12, 2023, 9:55am UTC](https://forum.inductiveautomation.com/t/export-dataset-to-excel-with-particular-cell-in-vision/73641 "2023-05-12T09:55:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Priyanka.Khandge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/priyanka.khandge/32/35989_2.png) [@Priyanka.Khandge](https://forum.inductiveautomation.com/u/Priyanka.Khandge)\
**Post date:** [May 12, 2023, 9:55am UTC](https://forum.inductiveautomation.com/t/export-dataset-to-excel-with-particular-cell-in-vision/73641/1 "2023-05-12T09:55:20Z")

</div>

Hi Guys,

I'm trying to export the dataset to Excel from a particular cell. Right now export data to Excel successfully but start from cell A1 I have tried to export from cell A4 any idea how to fix this?

Thanks,  
Priyanka

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [May 12, 2023, 10:00am UTC](https://forum.inductiveautomation.com/t/export-dataset-to-excel-with-particular-cell-in-vision/73641/2 "2023-05-12T10:00:51Z")

</div>

If you already have a solution that works for exporting a dataset to excel, the simplest thing would be to remove the rows you don't want from the dataset, then apply your solution to the reduced dataset.

[https://docs.inductiveautomation.com/display/DOC81/system.dataset.deleteRows](https://docs.inductiveautomation.com/display/DOC81/system.dataset.deleteRows)

---

<div class="post-metadata">

**Author:** ![Priyanka.Khandge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/priyanka.khandge/32/35989_2.png) [@Priyanka.Khandge](https://forum.inductiveautomation.com/u/Priyanka.Khandge)\
**Post date:** [May 12, 2023, 10:13am UTC](https://forum.inductiveautomation.com/t/export-dataset-to-excel-with-particular-cell-in-vision/73641/3 "2023-05-12T10:13:28Z")

</div>

@pascal.fragnoud Thanks for your response. In my case don't delete any row.

export data from cellA1  
My requirement is dataset export from cellA4.

---

<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:** [May 12, 2023, 10:51am UTC](https://forum.inductiveautomation.com/t/export-dataset-to-excel-with-particular-cell-in-vision/73641/4 "2023-05-12T10:51:02Z")

</div>

I added an option to offset the export.

> [@Copying an Excel file to a table's dataset](https://forum.inductiveautomation.com/t/copying-a-excel-file-to-a-tables-dataset/34942/7):
>
> The [Apache POI](https://poi.apache.org/apidocs/4.1/index.html) libraries are included with Ignition. At the time I was only needing to read files, so xlrd was all that was necessary. I'm just starting to dig into POI, myself, but here's a start: EDIT 2021-08-23: Updated to allow JsonDataSets. Changed to allow for a ByteArray output instead of writing to a file. EDIT 2023-01-20: Added option for date formats. Default is 'yyyy-MM-dd hh:mm:ss'. EDIT 2023-05-12: Added options for first row and column, if needed to offset from A1 def datasetT…

```python
sampleHeaders = ['Col1', 'Col2', 'Col3']
sampleData = [['ABC', 123, 9.87],
              ['DEF', 456, 6.54],
              ['GHI', 789, 3.21]
             ]

dataIn = system.dataset.toDataSet(sampleHeaders, sampleData)

util.datasetToExcel(dataIn, 'c:/test/poi offset.xlsx', firstRow=3, firstCol=1)

```

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

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [May 12, 2023, 11:26am UTC](https://forum.inductiveautomation.com/t/export-dataset-to-excel-with-particular-cell-in-vision/73641/5 "2023-05-12T11:26:29Z")

</div>

Oh, I misunderstood. Well, Jordan came to the rescue !

---

<div class="post-metadata">

**Author:** ![Priyanka.Khandge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/priyanka.khandge/32/35989_2.png) [@Priyanka.Khandge](https://forum.inductiveautomation.com/u/Priyanka.Khandge)\
**Post date:** [May 15, 2023, 10:40am UTC](https://forum.inductiveautomation.com/t/export-dataset-to-excel-with-particular-cell-in-vision/73641/6 "2023-05-15T10:40:20Z")

</div>

> [@Export dataset to excel with particular cell in vision](https://forum.inductiveautomation.com/t/export-dataset-to-excel-with-particular-cell-in-vision/73641/4):
>
> I added an option to offset the export. sampleHeaders = ['Col1', 'Col2', 'Col3'] sampleData = [['ABC', 123, 9.87], ['DEF', 456, 6.54], ['GHI', 789, 3.21] ] dataIn = system.dataset.toDataSet(sampleHeaders, sampleData) util.datasetToExcel(dataIn, 'c:/test/poi offset.xlsx', firstRow=3, firstCol=1) [image]

It worked perfectly but do you know how to open the URL?

> datasetToExcel(dataIn, 'c:/test/poi offset.xlsx', firstRow=3, firstCol=1)

This function directly mentions the file path. I'm trying to open the URL using the below script, but when I use the below hand the particular cell not worked.

system.dataset.exportExcel(fileName, 1, ds)  
if filePath != None:  
system.net.openURL("file://"+filePath)

---

<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:** [May 15, 2023, 10:54am UTC](https://forum.inductiveautomation.com/t/export-dataset-to-excel-with-particular-cell-in-vision/73641/7 "2023-05-15T10:54:44Z")

</div>

EDIT: fixed a mis-spell

```python
# Set save-to path
filePath = system.file.saveFile("myfile.xlsx")

#Process if a save-to path was entered.
if filePath is not None:
	sampleHeaders = ['Col1', 'Col2', 'Col3']
	sampleData = [['ABC', 123, 9.87],
	              ['DEF', 456, 6.54],
	              ['GHI', 789, 3.21]
	             ]
	
	dataIn = system.dataset.toDataSet(sampleHeaders, sampleData)
	
	# Create Excel file
	util.datasetToExcel(dataIn, filePath, firstRow=3, firstCol=1)
	# Open the Excel file
	system.net.openURL("file://"+filePath)

```

---

<div class="post-metadata">

**Author:** ![Priyanka.Khandge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/priyanka.khandge/32/35989_2.png) [@Priyanka.Khandge](https://forum.inductiveautomation.com/u/Priyanka.Khandge)\
**Post date:** [May 15, 2023, 11:46am UTC](https://forum.inductiveautomation.com/t/export-dataset-to-excel-with-particular-cell-in-vision/73641/8 "2023-05-15T11:46:00Z")

</div>

@JordanCClark Thank you so much. Worked Perfectly.  
You are a rockstar 😇
