CreateSheet
Creates a new sheet in Smartsheet for data organization and tracking.
Stored Procedure-Specific Information
If the rules specified below are not followed, the procedure will fail with an error.When executing this stored procedure, exactly one of the following parameters must be specified:
- WorkspaceId: creates the sheet in the specified workspace.
- FolderId: creates the sheet in the specified folder.
The same restriction applies for the following group of parameters:
- TemplateId: creates the sheet from a template.
- ColumnsAggregate: creates the sheet using the column definitions specified in the JSON array.
ColumnsAggregate
The value provided for the ColumnsAggregate parameter must be a JSON array of column definition objects in the following format:[
{
"title": "Primary Column",
"type": "TEXT_NUMBER",
"primary": true,
"description": "The main identifier for each row.",
"validation": true
},
{
"title": "Status",
"type": "PICKLIST",
"symbol": "HARVEY_BALLS",
"options": ["Not Started", "In Progress", "Complete"]
},
{
"title": "Ticket Number",
"type": "TEXT_NUMBER",
"systemColumnType": "AUTO_NUMBER",
"autoNumberFormat": {
"prefix": "TKT-",
"fill": "00000",
"startingNumber": 1
}
},
// ...
]
In more detail:
- The array must contain at least one column definition object.
- For each column definition object, both the title and type fields must be specified.
- Only one column can be marked as primary, and it must be of type TEXT_NUMBER.
For the correct value format for this input parameter refer to Smartsheet's API Documentation.
Examples
For examples on how to use this stored procedure, refer to the following queries:-- Create a sheet in a workspace with basic columns
EXECUTE CreateSheet Name = 'Project Tracker', WorkspaceId = '7116448184199044', ColumnsAggregate = '[{"title":"Task Name","type":"TEXT_NUMBER","primary":true,"description":"The name of the task."},{"title":"Status","type":"PICKLIST","options":["Not Started","In Progress","Complete"],"validation":true}]';
-- Create a sheet in a folder with system columns, contact options, and auto-number
EXECUTE CreateSheet Name = 'Team Tasks', FolderId = '3791509922310020', ColumnsAggregate = '[{"title":"Task","type":"TEXT_NUMBER","primary":true},{"title":"Assignee","type":"CONTACT_LIST","contactOptions":[{"email":"[email protected]","name":"Jane Doe"}]},{"title":"Ticket","type":"TEXT_NUMBER","systemColumnType":"AUTO_NUMBER","autoNumberFormat":{"prefix":"TKT-","fill":"00000","startingNumber":1}},{"title":"Created","type":"DATETIME","systemColumnType":"CREATED_DATE"}]';
Input
| Name | Type | Required | Description |
| Name | String | True | The name of the new sheet. Use a unique, descriptive name. |
| WorkspaceId | String | False | The unique identifier of the workspace that contains the new sheet. |
| FolderId | String | False | The unique identifier of the folder that contains the new sheet. |
| TemplateId | String | False | The unique identifier of the template to use for creating the new sheet. |
| ColumnsAggregate | String | False | A JSON array of column definition objects for the new sheet's columns. |
Result Set Columns
| Name | Type | Description |
| Success | Boolean | Indicates whether the sheet was created successfully. |
| Id | String | The unique identifier of the sheet created. |