I am trying to create a new sheet from a template using the SmartSheets API. Here is the code I am using to do so.
response = smart.Home.create_sheet_from_template(
smartsheet.models.Sheet({
'name': 'newsheet',
'from_id': temp_id # template_id
})
)
new_sheet = response.result
This does create a new sheet, however the only thing copied over from the template are simply the column names. The cell values, indentation, and background color did not copy over. I am assuming this is a problem with not including formatting in the the API call but I don't know how to fix the issue.
I want the entire template to be created as a new sheet, not just the column names.
You need to add the include
parameter to your API request, and use it to specify what types of things you want to include when creating the new sheet from the template. If you just want cell values, formatting, indentation, etc. then your code would look like this:
response = smart.Home.create_sheet_from_template(
smartsheet.models.Sheet({
'name': 'newsheet',
'from_id': temp_id # template_id
}),
include = 'data'
)
For a complete list of things you can choose to include when creating a new sheet from a template, see the description of the include
parameter here in the API docs: https://smartsheet.redoc.ly/tag/sheets#operation/create-sheet-in-sheets-folder.