Is there a way to mass-delete attachments that were generated with the document builder ?automation?

Almonto1
ββββ
I previously created a document mapping automation that attached a personalized report to each row of data, but it now requires edits. Is there a way to delete the old auto-generated attachments in one go without deleting the other attachments? If not, I'll have around 2 thousand rows to delete attachments from 1 by 1, so any assistance is appreciated!
Answers
-
Hi @Almonto1
Yes, there is a way β but you need to use the Smartsheet API.
Hereβs the overview:
- Use
List Attachments
API method to retrieve all attachments for the sheet. - Check the
Created By
field. Ifcreated_by.name
is "Smartsheet Automation", you can assume it was generated by the document builder. (*) - Use the
Delete Attachment
method to delete those attachments one by one. - Important: Since you have over 2000 rows, and Smartsheet does not allow bulk delete of attachments, you will need to make one API call per deletion.
- API Rate Limit is 300 calls per minute (Smartsheet API Best Practices).
- To avoid hitting the limit, pause every 300 deletes (wait 60 seconds).
- If you want help setting this up, feel free to contact me.
(*) Sample List Attachments Response
The first attachment is by me. The second attachment is by document builder automation.
Attachment ID: 7052208425963396, Name: Attachment to cell image test.pdf, Created by: jmiyazaki
Attachment ID: 1304140950835076, Name: Mapping for ζ₯ζ¬θͺγγ©γ³γ.pdf, Created by: Smartsheet Automation(Smartsheet API Documentation on Attachments)
Test code and result
- Use