Save Report in Excel format type

hi,
i am trying to save my report data which is in tabular form.
i am using the script on button :

import datetime
time = datetime.datetime.now()
tw = time.strftime("%Y-%m-%d %H:%M:%S")
st = "Report " + str(tw)
settings = {"path":"D:\Reports", "fileName":st, "format":"Xlsx"}
system.report.executeAndDistribute(path= "event.source.parent.getComponent('Report Viewer').reportPath" , project="SPC_SEFPRO", action="save", actionSettings=settings)

but i am getting an error:

help me how to save my report in excel format.

Don't put quotes around this.

i tried but getting error : invalid file path

\ is a special character. You either need to:
Denote it as a raw string with r"d:\hello"
Escape it with double backslash "D:\\hello"
Use / instead "D:/hello"

3 Likes

The path argument is the path to the report definition within the project, not a file path.

1 Like

@aman_sharma please remove the report viewer path and put the report path see the below screenshot for more info also I have added a sample code.

image

settings = {"path":"C:\\IgnitionReportBackup", "fileName":"Report.pdf", "format":"xlsx"}
test = system.report.executeAndDistribute(path="report test",project="SPC_SEFPRO", action="save", actionSettings=settings)
1 Like

thankyou!

1 Like