# Reports sendEmail and writeFile vs executeAndDistribute

**URL:** <https://forum.inductiveautomation.com/t/reports-sendemail-and-writefile-vs-executeanddistribute/92917>\
**Category:** Ignition\
**Created:** [July 8, 2024, 6:29pm UTC](https://forum.inductiveautomation.com/t/reports-sendemail-and-writefile-vs-executeanddistribute/92917 "2024-07-08T18:29:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zach\_Larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zach_larson/32/54388_2.png) [@Zach\_Larson](https://forum.inductiveautomation.com/u/Zach_Larson)\
**Post date:** [July 8, 2024, 6:29pm UTC](https://forum.inductiveautomation.com/t/reports-sendemail-and-writefile-vs-executeanddistribute/92917/1 "2024-07-08T18:29:00Z")

</div>

I have a report with some parameters.  
I will be saving the report and emailing it.

Option 1  
A gateway scheduled script with:

```python
system.report.executeAndDistribute()

```

Option 2  
A gateway scheduled script with:

```python
system.report.executeReport()
system.net.sendEmail()
system.file.writeFile()

```

The manual has a warning about executeAndDistribute() being blocked.  
I think the warning also applies to sendEmail() and executeReport() too though.

I think using a gateway scheduled script will make sure the report is emailed and saved either way though.

Is there a big difference to consider in the two options?

---

<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:** [July 8, 2024, 6:34pm UTC](https://forum.inductiveautomation.com/t/reports-sendemail-and-writefile-vs-executeanddistribute/92917/2 "2024-07-08T18:34:34Z")

</div>

`executeAndDistribute()` will clean up its temporary files. Otherwise there's no significant difference, if sending as attachments.

Consider storing in a database and using something like my Blob server to cough up the file on demand. Then your email can send just links.

---

<div class="post-metadata">

**Author:** ![Zach\_Larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zach_larson/32/54388_2.png) [@Zach\_Larson](https://forum.inductiveautomation.com/u/Zach_Larson)\
**Post date:** [July 8, 2024, 7:13pm UTC](https://forum.inductiveautomation.com/t/reports-sendemail-and-writefile-vs-executeanddistribute/92917/3 "2024-07-08T19:13:38Z")

</div>

Thanks

I will keep on schedule for now saving and emailing the report.

The second part bound my thoughts up.

For some reason when the email contained a report, I thought it was completely necessary to email.  
Knowing the email can just be a link, I am not sure why more than a perspective page is needed.  
I need to review my requirements in the next meeting.
