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?