# Converting a report to excel sheet

**URL:** <https://forum.inductiveautomation.com/t/converting-a-report-to-excel-sheet/80679>\
**Category:** Ignition\
**Created:** [October 19, 2023, 2:43am UTC](https://forum.inductiveautomation.com/t/converting-a-report-to-excel-sheet/80679 "2023-10-19T02:43:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bharat\_Krishnan](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@Bharat\_Krishnan](https://forum.inductiveautomation.com/u/Bharat_Krishnan)\
**Post date:** [October 19, 2023, 2:43am UTC](https://forum.inductiveautomation.com/t/converting-a-report-to-excel-sheet/80679/1 "2023-10-19T02:43:04Z")

</div>

I have been trying to download a report as excel file for which i have set up the following view given below and a button called "Save as XLS" is used. I am retrieving the data for the report using a single named query . I have created a script for converting the table data which is a dataset which is as follows :

```auto
def runAction(self, event):
	params = {"startDate":self.getSibling("ReportViewer").props.params.StartDate,"endDate":self.getSibling("ReportViewer").props.params.EndDate}
	results = system.db.runNamedQuery("COMMON_RESOURCES","COMMON RESOURCES/MACHINES/CONVEYOR/Conveyor_Accumulation_test",params)
	spreadsheet = system.dataset.toExcel(True, [results])
	filePath = "C:\IGNITION\REPORTS\CONVEYOR_ACCUMULATION.xlsx"
	system.file.writeFile(filePath, spreadsheet)

```

 ![Untitled](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/0/5053e56b134cd71055bc167d8f5e978cfa48166a.png)  
There is no error occurring in the log, but it does'nt write to the xcel file mentioned in the script. Am i doing something wrong with this

---

<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:** [October 19, 2023, 11:48am UTC](https://forum.inductiveautomation.com/t/converting-a-report-to-excel-sheet/80679/2 "2023-10-19T11:48:02Z")

</div>

`system.file.writeFile()` writes to a location in the gateway filesystem--Perspective doesn't have access to the filesystem at a client computer. Use `system.perspective.download()` instead.

---

<div class="post-metadata">

**Author:** ![Bharat\_Krishnan](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@Bharat\_Krishnan](https://forum.inductiveautomation.com/u/Bharat_Krishnan)\
**Post date:** [October 19, 2023, 11:12pm UTC](https://forum.inductiveautomation.com/t/converting-a-report-to-excel-sheet/80679/3 "2023-10-19T23:12:56Z")

</div>

I was able to download the excel file to the client computer but with the data, i have another question regarding displaying timestamps in excel sheet, the excel sheet only shows the date and i require the whole timestamp as returned from the named query. Is that possible?

 ![starttime](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/b/4bcf627570416b33a61bed3d21bbd96511e64ee0.png)
