# Adding exported file to email in automation causes: Object reference not set to an instance of an object

**URL:** <https://forums.toadworld.com/t/adding-exported-file-to-email-in-automation-causes-object-reference-not-set-to-an-instance-of-an-object/51521>\
**Category:** Toad Data Point & Toad Intelligence Central\
**Created:** [November 18, 2020, 2:08pm UTC](https://forums.toadworld.com/t/adding-exported-file-to-email-in-automation-causes-object-reference-not-set-to-an-instance-of-an-object/51521 "2020-11-18T14:08:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArjenLissenberg](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@ArjenLissenberg](https://forums.toadworld.com/u/ArjenLissenberg)\
**Post date:** [November 18, 2020, 2:08pm UTC](https://forums.toadworld.com/t/adding-exported-file-to-email-in-automation-causes-object-reference-not-set-to-an-instance-of-an-object/51521/1 "2020-11-18T14:08:05Z")

</div>

I have a scheduled automation that runs an exception report and then loops through a list of people/email addresses/departments generates ab excel file with a filtered list for that department and then send an email to department heads with that excel file as an attachment. The part where the the attachment should be added to the email triggers an "Object reference not set to an instance of an object" error.

How can I fix this?

---

<div class="post-metadata">

**Author:** ![Gary.Jerep](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/gary.jerep/32/205_2.png) [@Gary.Jerep](https://forums.toadworld.com/u/Gary.Jerep)\
**Post date:** [November 18, 2020, 6:56pm UTC](https://forums.toadworld.com/t/adding-exported-file-to-email-in-automation-causes-object-reference-not-set-to-an-instance-of-an-object/51521/2 "2020-11-18T18:56:57Z")

</div>

I assume the automation script has been running in the past without errors?  
Are there any additional clues in the script's log?

Given the sense of the error message, and without additional details, my first guess is that the script could not find the file to be attached to the e-mail.

---

<div class="post-metadata">

**Author:** ![dan](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/dan/32/12882_2.png) [@dan](https://forums.toadworld.com/u/dan)\
**Post date:** [November 23, 2020, 1:00pm UTC](https://forums.toadworld.com/t/adding-exported-file-to-email-in-automation-causes-object-reference-not-set-to-an-instance-of-an-object/51521/3 "2020-11-23T13:00:29Z")

</div>

Like Gary implies, can you try changing the path for the files that you link to or attach?
