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
-
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
- 10.7K Get Help
- 63 Global Discussions
- 69 Industry Talk
- 385 Announcements
- 3.5K Ideas & Feature Requests
- 55 Brandfolder
- 125 Just for fun
- 50 Community Job Board
- 464 Show & Tell
- 40 Member Spotlight
- 44 Power Your Process
- 28 Sponsor X
- 234 Events
- 7.3K Forum Archives