# Report Viewer Data need to export as excel

**URL:** <https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883>\
**Category:** Ignition\
**Tags:** database, scripting, ignition81, perspective\
**Created:** [March 31, 2023, 7:41am UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883 "2023-03-31T07:41:43Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![saravanan\_Manickam](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@saravanan\_Manickam](https://forum.inductiveautomation.com/u/saravanan_Manickam)\
**Post date:** [March 31, 2023, 7:41am UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883/1 "2023-03-31T07:41:43Z")

</div>

I have use a report viewer to display the report

which contains any table for example like , simple table , normal table , Cross table.....  
at the same time in single report it contain all table also...by binding with a multiple named Querys , basic SQL...

then I have used report viewer to display it on perspective in that as default it have Dowland option in the format of pdf.

but I required the data in the excel format.

---

<div class="post-metadata">

**Author:** ![jonathan.taylor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jonathan.taylor/32/4048_2.png) [@jonathan.taylor](https://forum.inductiveautomation.com/u/jonathan.taylor)\
**Post date:** [March 31, 2023, 7:52am UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883/2 "2023-03-31T07:52:43Z")

</div>

You can use this function on a diferrent button to either email the report to you in csv or xlsx, or save it to a location on the gateway that is accessible to Ignition, and write a script to grab the file and download it.

[https://docs.inductiveautomation.com/display/DOC81/system.report.executeAndDistribute](https://docs.inductiveautomation.com/display/DOC81/system.report.executeAndDistribute)

---

<div class="post-metadata">

**Author:** ![saravanan\_Manickam](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@saravanan\_Manickam](https://forum.inductiveautomation.com/u/saravanan_Manickam)\
**Post date:** [March 31, 2023, 8:06am UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883/3 "2023-03-31T08:06:59Z")

</div>

yeah

```auto
`# Executes and distributes the report to save a PDF`

`settings ` `=` `{` `"path"` `:` `"C:\\Ignition Reports"` `, ` `"fileName"` `:` `"Report.pdf"` `, ` `"format"` `:` `"pdf"` `}`

`system.report.executeAndDistribute(path` `=` `"My Report Path"` `, project` `=` `"My Project"` `, action` `=` `"save"` `, actionSettings` `=` `settings)`

```

let me change the format and will check.

---

<div class="post-metadata">

**Author:** ![saravanan\_Manickam](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@saravanan\_Manickam](https://forum.inductiveautomation.com/u/saravanan_Manickam)\
**Post date:** [March 31, 2023, 10:57am UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883/4 "2023-03-31T10:57:58Z")

</div>

```auto
	settings = {"path":"C:\\Ignition Reports", "fileName":"Report.xls", "format":"xls"}
	system.report.executeAndDistribute(path='ButylReports/SkidCleaningCheckSheet', project='DLB_NEW1', action="save", actionSettings=settings)
	

```

I tried no action have taken place

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/c/4c54253c3ab2cf4eeb715f0b311b9a739d0b0e3c.png)

any suggestion please

---

<div class="post-metadata">

**Author:** ![jonathan.taylor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jonathan.taylor/32/4048_2.png) [@jonathan.taylor](https://forum.inductiveautomation.com/u/jonathan.taylor)\
**Post date:** [March 31, 2023, 11:02am UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883/5 "2023-03-31T11:02:01Z")

</div>

Are you getting any errors in the gateway logs?

Have you checked the gateway's C:\Ignition Reports folder? Remember this script is being executed at the gateway, so it will save to the gateway, not your client.

---

<div class="post-metadata">

**Author:** ![saravanan\_Manickam](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@saravanan\_Manickam](https://forum.inductiveautomation.com/u/saravanan_Manickam)\
**Post date:** [March 31, 2023, 11:54am UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883/6 "2023-03-31T11:54:29Z")

</div>

my application is under this path

```auto
C:\Users\Administrator\.ignition

```

in that floder i can't find my xls file

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/e/de74ade8cb3c2dd90befe67446c628b00bd39359.png)

can I change my path 🤔

---

<div class="post-metadata">

**Author:** ![jonathan.taylor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jonathan.taylor/32/4048_2.png) [@jonathan.taylor](https://forum.inductiveautomation.com/u/jonathan.taylor)\
**Post date:** [March 31, 2023, 11:57am UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883/7 "2023-03-31T11:57:32Z")

</div>

Ok, is the gateway installed on that computer?

If it is, then is there a `C:\Ignition Reports` folder?

---

<div class="post-metadata">

**Author:** ![saravanan\_Manickam](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@saravanan\_Manickam](https://forum.inductiveautomation.com/u/saravanan_Manickam)\
**Post date:** [March 31, 2023, 11:59am UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883/8 "2023-03-31T11:59:41Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/7/273c1040c9b72a63733f938a950338be577df1a6.png)  
yes .,create by manually

---

<div class="post-metadata">

**Author:** ![samer\_samy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/samer_samy/32/52910_2.png) [@samer\_samy](https://forum.inductiveautomation.com/u/samer_samy)\
**Post date:** [June 6, 2024, 1:09pm UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883/9 "2024-06-06T13:09:54Z")

</div>

I have same problem as sara ,I need to print csv from a report ,I suceeded to run your script and receive the report ,but in the gateway C drive ,ignition reports folder .  
the report was encrypted and unreadable in csv format as per attachment.  
support pls  
[Reporttest.xls](https://forum.inductiveautomation.com/uploads/short-url/6SUYFoEplB4RwPm77JMbyiXBLCc.xls) (220 KB)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 6, 2024, 1:26pm UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883/10 "2024-06-06T13:26:01Z")

</div>

Reporttest.xls opened fine in Excel.  
There are graphics in it and the CSV format won't support that.

---

<div class="post-metadata">

**Author:** ![samer\_samy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/samer_samy/32/52910_2.png) [@samer\_samy](https://forum.inductiveautomation.com/u/samer_samy)\
**Post date:** [June 6, 2024, 2:31pm UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883/11 "2024-06-06T14:31:13Z")

</div>

Thanks transistor.  
I have two question :  
1-why csv not support although i can send email with csv attachment from my report?

2-how to download file in my client machine ?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 6, 2024, 5:34pm UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883/12 "2024-06-06T17:34:44Z")

</div>

1. CSV is a "flat file" format. Read the first table in [this](https://www.loc.gov/preservation/digital/formats/fdd/fdd000323.shtml#:~:text=CSV%20is%20a%20simple%20format,characters%20indicating%20a%20line%20break.) to get some idea of the loose specification.
2. I don't know. You didn't supply any code or error messages.

---

<div class="post-metadata">

**Author:** ![samer\_samy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/samer_samy/32/52910_2.png) [@samer\_samy](https://forum.inductiveautomation.com/u/samer_samy)\
**Post date:** [June 7, 2024, 11:42am UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883/13 "2024-06-07T11:42:47Z")

</div>

Dear Transistor,  
I am now able to download the csv file ,But it is downloaded on my gateway machine instead of my client machine .  
how to modify my script pls?

```python
	settings2 = {"path":"C:\\Ignition Reports", "fileName":"Reporttest.csv", "format":"csv"}
	system.report.executeAndDistribute(path='Power Management/CB', project='MegaMain', action="save", actionSettings=settings2)	

```

Regards,

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 7, 2024, 11:48am UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883/14 "2024-06-07T11:48:48Z")

</div>

Since this is a Perspective thread, then [system.perspective.download | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-perspective/system-perspective-download), I guess.

---

<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:** [June 7, 2024, 12:09pm UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883/15 "2024-06-07T12:09:06Z")

</div>

In case it isn't clear, you **cannot** distribute to a Perspective client's filesystem. You can only **download** through the browser, with only a **suggested** file name, and **no control at all** over the destination folder.

---

<div class="post-metadata">

**Author:** ![samer\_samy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/samer_samy/32/52910_2.png) [@samer\_samy](https://forum.inductiveautomation.com/u/samer_samy)\
**Post date:** [June 7, 2024, 8:29pm UTC](https://forum.inductiveautomation.com/t/report-viewer-data-need-to-export-as-excel/71883/16 "2024-06-07T20:29:33Z")

</div>

Thanks for support and patience,  
It is working now.

I modified the script to be :

````python
	bytesArray =system.report.executeReport(path='Power Management/CB2', project='MegaMain',parameters={'StartDate':self.parent.parent.getChild("ReportViewer").props.params.StartDate,'EndDate':self.parent.parent.getChild("ReportViewer").props.params.EndDate,'Circuit_Breaker_Name':self.parent.parent.getChild("ReportViewer").props.params.Circuit_Breaker_Name}, filetype="csv")	
	system.perspective.download(self.parent.parent.getChild("ReportViewer").props.params.Circuit_Breaker_Name+"\\"+str(self.parent.parent.getChild("ReportViewer").props.params.StartDate)+"\\TO\\"+str(self.parent.parent.getChild("ReportViewer").props.params.EndDate)+".csv", bytesArray) ```
````
