Smartsheet API to create csv
Hi,
I am trying to create csv file using smartsheet -python-sdk.. i am getting following error
response.save_to_file()
AttributeError: 'Error' object has no attribute 'save_to_file'
on further debugging i found that save_to_file module does not exist.
Is there any other way to export smartsheet to csv format via api call from python ?
Thanks in advance.
Answers
-
Hi @ashwanikk
Is it possible that you don't have a download_directory_path specified?
There's an example of the Python request for a CSV on the right in the API Documentation for Get Sheet (Sample 4): https://smartsheet.redoc.ly/tag/sheets#operation/getSheet
# Sample 4: Get sheet as CSV smartsheet_client.Sheets.get_sheet_as_csv( 1531988831168388, # sheet_id download_directory_path)
Let me know if this helped or not!
Cheers,
Genevieve
Join us at Smartsheet ENGAGE 2024 🎉
October 8 - 10, Seattle, WA | Register now -
I am currently having the same issue, I have the pathway specified and when I go to run it, I get the same error. I have attached the code below.
import smartsheet # smartsheet access token access_token = 'XXXXXXXXXXX' smartsheet_client = smartsheet.Smartsheet(access_token) sheet_id = 'XXXXXXXXXXXXXX' path = r'C:\path\to\folder' smartsheet_client.Sheets.get_sheet_as_pdf( sheet_id, path, 'A4', 'test_pdf.pdf' )
Please let me know if I am approaching this wrong or if there is a better solution for this.
Also, I'd like it to export in the calendar view, is it possible to accomplish this?
-
This worked for me:
###########
import smartsheet
smart = smartsheet.Smartsheet()
destf = "E:\\Scripting\\Python\\Downloads\\"
pa161 = smart.Sheets.get_sheet_as_pdf( <insert ID>, destf,'A1', 'test.pdf' )
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 62.9K Get Help
- 378 Global Discussions
- 208 Industry Talk
- 440 Announcements
- 4.5K Ideas & Feature Requests
- 139 Brandfolder
- 129 Just for fun
- 130 Community Job Board
- 449 Show & Tell
- 30 Member Spotlight
- 1 SmartStories
- 289 Events
- 33 Webinars
- 7.3K Forum Archives