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
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
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
- 64.3K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 143 Just for fun
- 59 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 300 Events
- 39 Webinars
- 7.3K Forum Archives