Extract sheetID from rows on report Smartsheet API

Options

Is there a way to obtain the sheetID, for the Smartsheet API, for each row found on a report?


I have a script to make modifications to sheets using the Smartsheet API. However, I had to locate the sheetID manually by accessing every single sheet and going to its properties. Is there a way to use the Smartsheet API to make a GET and obtain the sheetID for every row that appears on a report? Currently I am able to GET every row from the report and the cell information, but I want the sheetID so I can make a list and run my script faster.

Best Answer

  • Emilio Wright
    Emilio Wright ✭✭✭✭✭
    Answer ✓
    Options

    Thank you @Genevieve P. for your response. I was looking for some automated way of completing this. I used the API documentation and Python code to create a script to extract the IDs from the response of the Get. I have this on my github. So this code automatically extracts the sheet ids from a report and puts them on a csv. This csv can be used as values for an update to the sheet, etc.



Answers

  • Genevieve P.
    Options

    Hi @Emilio Wright

    Yes! The response from Get Report includes the Sheet ID for each individual row. Here's a sample response:

    Cheers,

    Genevieve

    Join us at Smartsheet ENGAGE 2024 🎉
    October 8 - 10, Seattle, WA | Register now

  • Emilio Wright
    Emilio Wright ✭✭✭✭✭
    Answer ✓
    Options

    Thank you @Genevieve P. for your response. I was looking for some automated way of completing this. I used the API documentation and Python code to create a script to extract the IDs from the response of the Get. I have this on my github. So this code automatically extracts the sheet ids from a report and puts them on a csv. This csv can be used as values for an update to the sheet, etc.



  • Genevieve P.
    Options

    Hi @Emilio Wright

    Thank you for posting your solution!

    Join us at Smartsheet ENGAGE 2024 🎉
    October 8 - 10, Seattle, WA | Register now

  • Emilio Wright
    Emilio Wright ✭✭✭✭✭
    Options

    @Genevieve P. Of course. Once I familiarize myself with GitHub some more and ensure that I dont expose some of my private data, I will make my smartsheet workspace on GitHub public because I have not seen many posts online providing assistance on using the API with Python. I have found that this Python approach provides a lot more flexibility that Control Center does not offer, especially when fixing issues on already provisioned projects that cant be done with Control Center, like column alignments, Multi contact or select picklists, sheet summary changes, etc.


    My latest project with the API is extracting sheet ids from the report into a csv, using those ids in a loop to get the sheet summary fields and their ids to make updates. Powerful stuff, very interesting.