Sheet_ExampleSheet
An example of a dynamic add-in table (sheets in Smartsheet).
Table-Specific Information
The add-in creates a dynamic table for each sheet in your Smartsheet account, following the naming pattern Sheet_{SheetName}. The examples below use the sample table Sheet_ExampleSheet, but they apply to any dynamic sheet table.
SELECT
Retrieve all rows and columns of a sheet.SELECT * FROM [Sheet_ExampleSheet]
Retrieve specific columns for rows that meet a condition.
SELECT RowId, PrimaryColumn, TextColumn FROM [Sheet_ExampleSheet] WHERE NumberColumn > 100
INSERT
Insert a new row. By default, new rows are added to the bottom of the sheet.INSERT INTO [Sheet_ExampleSheet] (PrimaryColumn, TextColumn) VALUES (1, 'New row')
Use the ToTop, ParentRowId, and SiblingRowId pseudocolumns to control where the new row is placed. These pseudocolumns are only valid for INSERT statements.
Insert a row at the top of the sheet.
INSERT INTO [Sheet_ExampleSheet] (PrimaryColumn, TextColumn, ToTop) VALUES (2, 'Top row', true)
Insert a row as the first child of an existing row (top of the indented section) by setting ParentRowId and ToTop to True.
INSERT INTO [Sheet_ExampleSheet] (PrimaryColumn, TextColumn, ParentRowId, ToTop) VALUES (3, 'First child', '4583270082361988', true)
Insert a row as the last child of an existing row (bottom of the indented section) by setting ParentRowId alone.
INSERT INTO [Sheet_ExampleSheet] (PrimaryColumn, TextColumn, ParentRowId) VALUES (4, 'Last child', '4583270082361988')
Insert a row immediately below an existing row, at the same indentation level, by setting SiblingRowId alone.
INSERT INTO [Sheet_ExampleSheet] (PrimaryColumn, TextColumn, SiblingRowId) VALUES (5, 'Below sibling', '4583270082361988')
Insert a row immediately above an existing row by setting SiblingRowId and ToTop to True.
INSERT INTO [Sheet_ExampleSheet] (PrimaryColumn, TextColumn, SiblingRowId, ToTop) VALUES (6, 'Above sibling', '4583270082361988', true)
Note: ParentRowId and SiblingRowId cannot both be specified for the same row.
UPDATE
Update column values for an existing row.UPDATE [Sheet_ExampleSheet] SET TextColumn = 'Updated value' WHERE RowId = '4583270082361988'
Use the Indentation pseudocolumn to indent or outdent an existing row. This pseudocolumn is only valid for UPDATE statements. Set it to 1 to indent the row one level, or -1 to outdent it one level.
UPDATE [Sheet_ExampleSheet] SET Indentation = 1 WHERE RowId = '4583270082361988';
UPDATE [Sheet_ExampleSheet] SET Indentation = -1 WHERE RowId = '4583270082361988';
DELETE
Delete a row by providing the RowId.DELETE FROM [Sheet_ExampleSheet] WHERE RowId = '4583270082361988'
Columns
| Name | Type | ReadOnly | References | Description |
| RowId [KEY] | String | True |
The 'RowId' column. | |
| PrimaryColumn | Int | False |
The 'PrimaryColumn' column. | |
| TextColumn | String | False |
The 'TextColumn' column. | |
| CheckboxColumn | Boolean | False |
The 'CheckboxColumn' column. | |
| NumberColumn | Double | False |
The 'NumberColumn' column. | |
| DateColumn | Date | False |
The 'DateColumn' column. | |
| ContactListColumn | String | False |
The 'ContactListColumn' column. | |
| Indentation | Tinyint | False |
If set to 1, indents the row one level. If set to -1, outdents the row one level. Only valid for UPDATE statements. |
Pseudocolumns
Pseudocolumn fields are used in the WHERE clause of SELECT statements and offer more granular control over the data returned from the data source.
| Name | Type | Description |
| ToTop | Boolean |
If set to 'True', the row is placed at the top of the sheet when executing INSERT statements. If left unspecified or 'False', the row is placed at the bottom instead. Combined with ParentRowId, 'True' places the row as the first child of the specified row and 'False' places it as the last child. Combined with SiblingRowId, 'True' places the row immediately above the specified row and 'False' places it immediately below. Only valid for INSERT statements. |
| ParentRowId | String |
The RowId of the row that should become this row's parent when executing INSERT statements. Only valid for INSERT statements. |
| SiblingRowId | String |
The RowId of the row that should become this row's sibling when executing INSERT statements. Only valid for INSERT statements. |