Smartsheet API to create csv


I am trying to create csv file using smartsheet -python-sdk.. i am getting following error


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.


  • Genevieve P.
    Genevieve P. Employee Admin

    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):

    # Sample 4: Get sheet as CSV
      1531988831168388,           # sheet_id

    Let me know if this helped or not!



  • Parker Oxford
    Parker Oxford ✭✭✭✭✭

    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'

    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?

  • Alex Argumedo
    Alex Argumedo ✭✭✭✭

    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' )