To Excel as xlsx?

I am currently running a named query that gets exported to excel using system.dataset.exportExcel which works but can only currently export as an xls file. Is there a work around to export as xlsx file?

As of 8.0.7, system.dataset.toExcel() and system.dataset.exportExcel() have support for and default to xlsx. If you are on that version or higher you just need to make sure you are saving the file with the xlsx extension.


do you have an example of this code, i’m currently trying to do this and cant figure it out. Here is my code

table =system.db.runNamedQuery(“DailyRunQ”, {})
import time
timestr = time.strftime("%Y.%m.%d")
print timestr

from os.path import expanduser
home = expanduser("~")

filePath = system.dataset.exportExcel(home + “\Documents\CIP Consumption Data\” + timestr + “.Consumption Data.xls”, 1,
if filePath != None:

Try changing to Consumption Data.xlsx

Welcome to the form! PS, try to use preformatted text </> when posting your code.

1 Like


Thank you for the response. The issue i’m having isn’t with the format .xls vs .xlsx,

What i’m not able to get to do is get the named query database to execute and then save into the xls at all. I am completely new to this environment and coding in general, so I was hoping to see how user cfuta was able to get his code setup to execute a named query and save to an excel sheet

i got it, i was trying to call it into a table instead of just having the export function pull it directly. Thank you!

1 Like