Converting a report to excel sheet

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 :

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])
	system.file.writeFile(filePath, spreadsheet)

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

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


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?