Adding an Attachment via API (Python)
Hello all,
Apologies in advance for what will be a basic question for some, however I am going insane trying to figure this out.
Struggling to add an attachment via the API, have been on the Github and the Getting Started resources provided by Smartsheet and still no joy. It is completely down to a lack of experience with both Python and APIs in general.
Any help would be greatly appreciated! See my code below;
import requests
import smartsheet
POST https://api.smartsheet.com/2.0/sheets/4509093797881732/attachments
Authorization: Bearer [token]
Content-Disposition: attachment; filename="SmartsheetAttach.xlsm"
Content-Type: application/vnd.ms-excel
Content-Length:
updated_attachment = smartsheet_client.Attachments.attach_file_to_row(
2210007551895428, # sheet_id
7527539601631108, # row_id
('SmartsheetAttach.xlsm',
open('C:\Users\[username]\Desktop\SmartsheetAttach.xlsm', 'rb'),
'application/vnd.ms-excel')
)
Print("Complete")
Answers
-
Typically for API work on smartsheet Stack Overflow is a better resource than smartsheet community if you haven't already solved this problem.
Good luck!
-
I have a similar requirement. any update on this thread?
Attaching a simple (tiny) CSV file to the sheet.
Anyone can share a sample Postman collection?
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.2K Get Help
- 414 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 141 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives