I am trying to use the Smartsheet API to download a sheet as an excel file. I am really struggling to put together the correct code to do this.
Can you provide a basic code example that will download an excel file using the Smartsheet API?
I am trying to use the Smartsheet API to download a sheet as an excel file. I am really struggling to put together the correct code to do this.
Can you provide a basic code example that will download an excel file using the Smartsheet API?
The documentation for creating an excel file from a sheet is here. It gives an example that uses curl. After curl is installed the following command can be used with the bold fields replaced with the appropriate values:
SHEET_ID: this is the id of the sheet. It can be retrieved inside the smartsheet interface (screenshot below) by right clicking on a sheet tab and selecting properties. It can also be retrieved via the API by hitting the sheets endpoint (https://api.smartsheet.com/1.1/sheets). More info on the endpoint is here.
ACCESS_TOKEN: Is a token that can be retrieved via the smartsheet interface by clicking on "Account" selecting "Personal Settings" and then clicking "API Access". Then click the "Generate new access token" button to create a new token.
OUTPUT.XLS: is the name of the excel file that will be created in the current directory.
I also want to point out that the same steps can be accomplished using Smartsheet's Java SDK. After installing the SDK the following code can be used to download a sheet as an Excel file.
Again, replace SHEET_ID, ACCESS_TOKEN and OUTPUT.XLS with the appropriate values.