Use Microsoft Excel in Agent Serve to read and write workbook data. Select a worksheet and range, such as A1:D10, to target the cells an operation uses. Additional actions clear, format, and sort ranges, create tables, and delete worksheets.
Integrate Microsoft Excel into the workflow with explicit sheet selection. Read and write values and formulas, manage worksheets and table rows, format ranges, and calculate workbooks with persistent or temporary sessions.
Add new rows to a Microsoft Excel table
| Parameter | Type | Required | Description |
|---|
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
spreadsheetId | string | Yes | The ID of the spreadsheet/workbook containing the table (e.g., "01ABC123DEF456") |
driveId | string | No | The ID of the drive containing the spreadsheet. Required for SharePoint files. If omitted, uses the signed-in user’s default OneDrive. Excel workbook APIs require a business account. |
tableName | string | Yes | The name of the table to add rows to (e.g., "Table1", "SalesTable") |
index | number | No | Zero-based insertion index. Omit to append at the end. |
values | array | No | Data rows in table column order, without headers (e.g., [["Value", 30]]). Object rows are also accepted in key order for compatibility. Omit to add a blank row. |
| Parameter | Type | Description |
|---|
index | number | Index of the first row that was added |
metadata | object | Spreadsheet metadata |
↳ spreadsheetId | string | The ID of the spreadsheet |
↳ spreadsheetUrl | string | URL to access the spreadsheet |
Create a new worksheet (sheet) in a Microsoft Excel workbook
| Parameter | Type | Required | Description |
|---|
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
spreadsheetId | string | Yes | The ID of the Excel workbook to add the worksheet to (e.g., "01ABC123DEF456") |
driveId | string | No | The ID of the drive containing the spreadsheet. Required for SharePoint files. If omitted, uses the signed-in user’s default OneDrive. Excel workbook APIs require a business account. |
worksheetName | string | No | The name of the new worksheet (e.g., "Sales Q1", "Data"). Omit for an automatic name. Supplied names must be unique within the workbook and cannot exceed 31 characters |
| Parameter | Type | Description |
|---|
worksheet | object | Details of the newly created worksheet |
↳ id | string | The unique ID of the worksheet |
↳ name | string | The name of the worksheet |
↳ position | number | The zero-based position of the worksheet |
↳ visibility | string | The visibility state of the worksheet (Visible/Hidden/VeryHidden) |
metadata | object | Spreadsheet metadata |
↳ spreadsheetId | string | The ID of the spreadsheet |
↳ spreadsheetUrl | string | URL to access the spreadsheet |
List Worksheets in a Microsoft Excel workbook.
| Parameter | Type | Required | Description |
|---|
spreadsheetId | string | Yes | Workbook drive item ID. |
driveId | string | No | Drive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account. |
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
top | number | No | Page size ($top), from 1 to 1000. Defaults to 100. |
skip | number | No | Number of items to skip ($skip). Defaults to 0. Increase by the returned count to read the next page. |
| Parameter | Type | Description |
|---|
worksheets | array | Worksheets in this page. |
Get Worksheet in a Microsoft Excel workbook.
| Parameter | Type | Required | Description |
|---|
spreadsheetId | string | Yes | Workbook drive item ID. |
driveId | string | No | Drive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account. |
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
sheetName | string | Yes | Worksheet ID or name within the workbook. |
| Parameter | Type | Description |
|---|
addressLocal | string | Range property: addressLocal |
cellCount | number | Range property: cellCount |
columnCount | number | Range property: columnCount |
columnHidden | boolean | Range property: columnHidden |
columnIndex | number | Range property: columnIndex |
formulas | json | Two-dimensional cell matrix: formulas |
formulasLocal | json | Two-dimensional cell matrix: formulasLocal |
formulasR1C1 | json | Two-dimensional cell matrix: formulasR1C1 |
hidden | boolean | Range property: hidden |
numberFormat | json | Two-dimensional cell matrix: numberFormat |
rowCount | number | Range property: rowCount |
rowHidden | boolean | Range property: rowHidden |
rowIndex | number | Range property: rowIndex |
text | json | Two-dimensional cell matrix: text |
valueTypes | json | Two-dimensional cell matrix: valueTypes |
worksheet | json | Worksheet properties (id, name, position, visibility) |
worksheets | json | Worksheet page [{id, name, position, visibility}] |
tables | json | Table page with IDs, names, styles, header/totals visibility, and formatting flags |
rows | json | Table row page [{index, values}] |
index | number | Zero-based table row index |
nextLink | string | Provider continuation link when returned |
count | number | Number of items returned in this page |
sessionId | string | Created workbook session ID |
persistChanges | boolean | Whether session changes are saved |
closed | boolean | Whether the session was closed |
refreshed | boolean | Whether the session was refreshed |
calculated | boolean | Whether workbook calculation completed |
sheetName | string | Name of the sheet |
range | string | Range that was read |
values | json | Cell values as a two-dimensional array |
updatedRange | string | Updated range |
updatedRows | number | Updated rows count |
updatedColumns | number | Updated columns count |
updatedCells | number | Updated cells count |
cleared | boolean | Whether the range was cleared |
applyTo | string | What was cleared (All, Contents, or Formats) |
formatted | boolean | Whether the formatting was applied |
fill | json | Applied fill ({color}) or null |
font | json | Applied font ({bold, italic, color, name, size}) or null |
table | json | Created table ({id, name, showHeaders, showTotals, style}) |
deleted | boolean | Whether the worksheet, table, or row was deleted |
worksheetName | string | Name of the deleted worksheet |
sorted | boolean | Whether the sort was applied |
target | string | The range or table name that was sorted |
metadata | json | Spreadsheet metadata including ID and URL |
Update Worksheet in a Microsoft Excel workbook.
| Parameter | Type | Required | Description |
|---|
spreadsheetId | string | Yes | Workbook drive item ID. |
driveId | string | No | Drive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account. |
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
sheetName | string | Yes | Worksheet ID or name within the workbook. |
name | string | No | New worksheet name, unique within the workbook (maximum 31 characters). |
position | number | No | New zero-based worksheet position. |
visibility | string | No | Visible, Hidden, or VeryHidden. |
| Parameter | Type | Description |
|---|
addressLocal | string | Range property: addressLocal |
cellCount | number | Range property: cellCount |
columnCount | number | Range property: columnCount |
columnHidden | boolean | Range property: columnHidden |
columnIndex | number | Range property: columnIndex |
formulas | json | Two-dimensional cell matrix: formulas |
formulasLocal | json | Two-dimensional cell matrix: formulasLocal |
formulasR1C1 | json | Two-dimensional cell matrix: formulasR1C1 |
hidden | boolean | Range property: hidden |
numberFormat | json | Two-dimensional cell matrix: numberFormat |
rowCount | number | Range property: rowCount |
rowHidden | boolean | Range property: rowHidden |
rowIndex | number | Range property: rowIndex |
text | json | Two-dimensional cell matrix: text |
valueTypes | json | Two-dimensional cell matrix: valueTypes |
worksheet | json | Worksheet properties (id, name, position, visibility) |
worksheets | json | Worksheet page [{id, name, position, visibility}] |
tables | json | Table page with IDs, names, styles, header/totals visibility, and formatting flags |
rows | json | Table row page [{index, values}] |
index | number | Zero-based table row index |
nextLink | string | Provider continuation link when returned |
count | number | Number of items returned in this page |
sessionId | string | Created workbook session ID |
persistChanges | boolean | Whether session changes are saved |
closed | boolean | Whether the session was closed |
refreshed | boolean | Whether the session was refreshed |
calculated | boolean | Whether workbook calculation completed |
sheetName | string | Name of the sheet |
range | string | Range that was read |
values | json | Cell values as a two-dimensional array |
updatedRange | string | Updated range |
updatedRows | number | Updated rows count |
updatedColumns | number | Updated columns count |
updatedCells | number | Updated cells count |
cleared | boolean | Whether the range was cleared |
applyTo | string | What was cleared (All, Contents, or Formats) |
formatted | boolean | Whether the formatting was applied |
fill | json | Applied fill ({color}) or null |
font | json | Applied font ({bold, italic, color, name, size}) or null |
table | json | Created table ({id, name, showHeaders, showTotals, style}) |
deleted | boolean | Whether the worksheet, table, or row was deleted |
worksheetName | string | Name of the deleted worksheet |
sorted | boolean | Whether the sort was applied |
target | string | The range or table name that was sorted |
metadata | json | Spreadsheet metadata including ID and URL |
List Tables in a Microsoft Excel workbook.
| Parameter | Type | Required | Description |
|---|
spreadsheetId | string | Yes | Workbook drive item ID. |
driveId | string | No | Drive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account. |
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
top | number | No | Page size ($top), from 1 to 1000. Defaults to 100. |
skip | number | No | Number of items to skip ($skip). Defaults to 0. Increase by the returned count to read the next page. |
| Parameter | Type | Description |
|---|
tables | array | Tables in this page. |
Get Table in a Microsoft Excel workbook.
| Parameter | Type | Required | Description |
|---|
spreadsheetId | string | Yes | Workbook drive item ID. |
driveId | string | No | Drive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account. |
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
tableName | string | Yes | Table ID or name within the workbook. |
| Parameter | Type | Description |
|---|
addressLocal | string | Range property: addressLocal |
cellCount | number | Range property: cellCount |
columnCount | number | Range property: columnCount |
columnHidden | boolean | Range property: columnHidden |
columnIndex | number | Range property: columnIndex |
formulas | json | Two-dimensional cell matrix: formulas |
formulasLocal | json | Two-dimensional cell matrix: formulasLocal |
formulasR1C1 | json | Two-dimensional cell matrix: formulasR1C1 |
hidden | boolean | Range property: hidden |
numberFormat | json | Two-dimensional cell matrix: numberFormat |
rowCount | number | Range property: rowCount |
rowHidden | boolean | Range property: rowHidden |
rowIndex | number | Range property: rowIndex |
text | json | Two-dimensional cell matrix: text |
valueTypes | json | Two-dimensional cell matrix: valueTypes |
worksheet | json | Worksheet properties (id, name, position, visibility) |
worksheets | json | Worksheet page [{id, name, position, visibility}] |
tables | json | Table page with IDs, names, styles, header/totals visibility, and formatting flags |
rows | json | Table row page [{index, values}] |
index | number | Zero-based table row index |
nextLink | string | Provider continuation link when returned |
count | number | Number of items returned in this page |
sessionId | string | Created workbook session ID |
persistChanges | boolean | Whether session changes are saved |
closed | boolean | Whether the session was closed |
refreshed | boolean | Whether the session was refreshed |
calculated | boolean | Whether workbook calculation completed |
sheetName | string | Name of the sheet |
range | string | Range that was read |
values | json | Cell values as a two-dimensional array |
updatedRange | string | Updated range |
updatedRows | number | Updated rows count |
updatedColumns | number | Updated columns count |
updatedCells | number | Updated cells count |
cleared | boolean | Whether the range was cleared |
applyTo | string | What was cleared (All, Contents, or Formats) |
formatted | boolean | Whether the formatting was applied |
fill | json | Applied fill ({color}) or null |
font | json | Applied font ({bold, italic, color, name, size}) or null |
table | json | Created table ({id, name, showHeaders, showTotals, style}) |
deleted | boolean | Whether the worksheet, table, or row was deleted |
worksheetName | string | Name of the deleted worksheet |
sorted | boolean | Whether the sort was applied |
target | string | The range or table name that was sorted |
metadata | json | Spreadsheet metadata including ID and URL |
Update Table in a Microsoft Excel workbook.
| Parameter | Type | Required | Description |
|---|
spreadsheetId | string | Yes | Workbook drive item ID. |
driveId | string | No | Drive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account. |
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
tableName | string | Yes | Table ID or name within the workbook. |
name | string | No | New unique table name. |
showHeaders | boolean | No | Whether to show the header row. |
showTotals | boolean | No | Whether to show the totals row. |
style | string | No | Built-in table style (TableStyleLight1–21, TableStyleMedium1–28, TableStyleDark1–11) or a custom style already in the workbook. |
| Parameter | Type | Description |
|---|
addressLocal | string | Range property: addressLocal |
cellCount | number | Range property: cellCount |
columnCount | number | Range property: columnCount |
columnHidden | boolean | Range property: columnHidden |
columnIndex | number | Range property: columnIndex |
formulas | json | Two-dimensional cell matrix: formulas |
formulasLocal | json | Two-dimensional cell matrix: formulasLocal |
formulasR1C1 | json | Two-dimensional cell matrix: formulasR1C1 |
hidden | boolean | Range property: hidden |
numberFormat | json | Two-dimensional cell matrix: numberFormat |
rowCount | number | Range property: rowCount |
rowHidden | boolean | Range property: rowHidden |
rowIndex | number | Range property: rowIndex |
text | json | Two-dimensional cell matrix: text |
valueTypes | json | Two-dimensional cell matrix: valueTypes |
worksheet | json | Worksheet properties (id, name, position, visibility) |
worksheets | json | Worksheet page [{id, name, position, visibility}] |
tables | json | Table page with IDs, names, styles, header/totals visibility, and formatting flags |
rows | json | Table row page [{index, values}] |
index | number | Zero-based table row index |
nextLink | string | Provider continuation link when returned |
count | number | Number of items returned in this page |
sessionId | string | Created workbook session ID |
persistChanges | boolean | Whether session changes are saved |
closed | boolean | Whether the session was closed |
refreshed | boolean | Whether the session was refreshed |
calculated | boolean | Whether workbook calculation completed |
sheetName | string | Name of the sheet |
range | string | Range that was read |
values | json | Cell values as a two-dimensional array |
updatedRange | string | Updated range |
updatedRows | number | Updated rows count |
updatedColumns | number | Updated columns count |
updatedCells | number | Updated cells count |
cleared | boolean | Whether the range was cleared |
applyTo | string | What was cleared (All, Contents, or Formats) |
formatted | boolean | Whether the formatting was applied |
fill | json | Applied fill ({color}) or null |
font | json | Applied font ({bold, italic, color, name, size}) or null |
table | json | Created table ({id, name, showHeaders, showTotals, style}) |
deleted | boolean | Whether the worksheet, table, or row was deleted |
worksheetName | string | Name of the deleted worksheet |
sorted | boolean | Whether the sort was applied |
target | string | The range or table name that was sorted |
metadata | json | Spreadsheet metadata including ID and URL |
Delete Table in a Microsoft Excel workbook.
| Parameter | Type | Required | Description |
|---|
spreadsheetId | string | Yes | Workbook drive item ID. |
driveId | string | No | Drive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account. |
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
tableName | string | Yes | Table ID or name within the workbook. |
| Parameter | Type | Description |
|---|
deleted | boolean | Whether the table was deleted. |
List Table Rows in a Microsoft Excel workbook.
| Parameter | Type | Required | Description |
|---|
spreadsheetId | string | Yes | Workbook drive item ID. |
driveId | string | No | Drive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account. |
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
top | number | No | Page size ($top), from 1 to 1000. Defaults to 100. |
skip | number | No | Number of items to skip ($skip). Defaults to 0. Increase by the returned count to read the next page. |
tableName | string | Yes | Table ID or name within the workbook. |
| Parameter | Type | Description |
|---|
rows | array | Table Rows in this page. |
Get Table Row in a Microsoft Excel workbook.
| Parameter | Type | Required | Description |
|---|
spreadsheetId | string | Yes | Workbook drive item ID. |
driveId | string | No | Drive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account. |
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
tableName | string | Yes | Table ID or name within the workbook. |
index | number | Yes | Zero-based table row index. Indexes can change when rows are inserted or deleted. |
| Parameter | Type | Description |
|---|
index | number | Zero-based table row index. |
Update Table Row in a Microsoft Excel workbook.
| Parameter | Type | Required | Description |
|---|
spreadsheetId | string | Yes | Workbook drive item ID. |
driveId | string | No | Drive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account. |
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
tableName | string | Yes | Table ID or name within the workbook. |
index | number | Yes | Zero-based table row index. Indexes can change when rows are inserted or deleted. |
values | array | Yes | Exactly one row as a two-dimensional array, in table column order. Use null to leave a cell unchanged. |
| Parameter | Type | Description |
|---|
index | number | Zero-based table row index. |
Delete Table Row in a Microsoft Excel workbook.
| Parameter | Type | Required | Description |
|---|
spreadsheetId | string | Yes | Workbook drive item ID. |
driveId | string | No | Drive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account. |
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
tableName | string | Yes | Table ID or name within the workbook. |
index | number | Yes | Zero-based table row index. Indexes can change when rows are inserted or deleted. |
| Parameter | Type | Description |
|---|
deleted | boolean | Whether the table row was deleted. |
Create Session in a Microsoft Excel workbook.
| Parameter | Type | Required | Description |
|---|
spreadsheetId | string | Yes | Workbook drive item ID. |
driveId | string | No | Drive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account. |
persistChanges | boolean | Yes | True saves changes; false creates a temporary workbook copy whose changes are discarded when the session ends. |
| Parameter | Type | Description |
|---|
sessionId | string | Pass this ID as sessionId on subsequent workbook operations. |
persistChanges | boolean | Whether changes in this session are saved. |
Refresh Session in a Microsoft Excel workbook.
| Parameter | Type | Required | Description |
|---|
spreadsheetId | string | Yes | Workbook drive item ID. |
driveId | string | No | Drive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account. |
sessionId | string | Yes | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
| Parameter | Type | Description |
|---|
refreshed | boolean | Whether the workbook session was refreshed. |
Close Session in a Microsoft Excel workbook.
| Parameter | Type | Required | Description |
|---|
spreadsheetId | string | Yes | Workbook drive item ID. |
driveId | string | No | Drive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account. |
sessionId | string | Yes | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
| Parameter | Type | Description |
|---|
closed | boolean | Whether the workbook session was closed. |
Calculate in a Microsoft Excel workbook.
| Parameter | Type | Required | Description |
|---|
spreadsheetId | string | Yes | Workbook drive item ID. |
driveId | string | No | Drive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account. |
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
calculationType | string | Yes | Recalculate recalculates dirty cells; Full recalculates all cells; FullRebuild rebuilds dependencies and recalculates all cells. |
| Parameter | Type | Description |
|---|
calculated | boolean | Whether workbook calculation completed. |
Read data from a specific sheet in a Microsoft Excel spreadsheet
| Parameter | Type | Required | Description |
|---|
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
spreadsheetId | string | Yes | The ID of the spreadsheet/workbook to read from (e.g., "01ABC123DEF456") |
driveId | string | No | The ID of the drive containing the spreadsheet. Required for SharePoint files. If omitted, uses the signed-in user’s default OneDrive. Excel workbook APIs require a business account. |
sheetName | string | Yes | The name of the sheet/tab to read from (e.g., "Sheet1", "Sales Data") |
cellRange | string | No | The cell range to read (e.g., "A1:D10"). If not specified, reads the entire used range. |
| Parameter | Type | Description |
|---|
sheetName | string | Name of the sheet that was read |
range | string | The range that was read |
metadata | json | Spreadsheet metadata including ID and URL |
↳ spreadsheetId | string | Microsoft Excel spreadsheet ID |
↳ spreadsheetUrl | string | Spreadsheet URL |
Write data to a specific sheet in a Microsoft Excel spreadsheet
| Parameter | Type | Required | Description |
|---|
formulas | array | No | A1-style formulas as a two-dimensional array. Null leaves a cell unchanged. |
formulasLocal | array | No | A1-style formulas in the user locale as a two-dimensional array. Null leaves a cell unchanged. |
formulasR1C1 | array | No | R1C1-style formulas as a two-dimensional array. Null leaves a cell unchanged. |
numberFormat | array | No | Excel number format codes as a two-dimensional array. Null leaves a cell unchanged. |
columnHidden | boolean | No | Hide all columns in the target range. |
rowHidden | boolean | No | Hide all rows in the target range. |
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
spreadsheetId | string | Yes | The ID of the spreadsheet/workbook to write to (e.g., "01ABC123DEF456") |
driveId | string | No | The ID of the drive containing the spreadsheet. Required for SharePoint files. If omitted, uses the signed-in user’s default OneDrive. Excel workbook APIs require a business account. |
sheetName | string | Yes | The name of the sheet/tab to write to (e.g., "Sheet1", "Sales Data") |
cellRange | string | No | The cell range to write to (e.g., "A1:D10", "A1"). Defaults to "A1" if not specified. |
values | array | No | The data to write as a 2D array (used exactly as provided) or array of objects. For object rows, their keys become a header row. Use a 2D array to write data without added headers. |
| Parameter | Type | Description |
|---|
updatedRange | string | Range of cells that were updated |
updatedRows | number | Number of rows updated |
updatedColumns | number | Number of columns updated |
updatedCells | number | Number of cells updated |
metadata | json | Spreadsheet metadata including ID and URL |
↳ spreadsheetId | string | Microsoft Excel spreadsheet ID |
↳ spreadsheetUrl | string | Spreadsheet URL |
Clear the values and/or formatting of a range in a Microsoft Excel worksheet
| Parameter | Type | Required | Description |
|---|
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
spreadsheetId | string | Yes | The ID of the spreadsheet/workbook (e.g., "01ABC123DEF456") |
driveId | string | No | The ID of the drive containing the spreadsheet. Required for SharePoint files. If omitted, uses the signed-in user’s default OneDrive. Excel workbook APIs require a business account. |
sheetName | string | No | The name of the worksheet (e.g., "Sheet1"). If omitted, the range must use the combined "Sheet1!A1:B2" format. |
range | string | Yes | The cell range to clear (e.g., "A1:D10" or "Sheet1!A1:D10") |
applyTo | string | No | What to clear: "All", "Formats", or "Contents". Defaults to "All". |
| Parameter | Type | Description |
|---|
cleared | boolean | Whether the range was cleared |
range | string | The range that was cleared |
applyTo | string | What was cleared (All, Formats, or Contents) |
metadata | object | Spreadsheet metadata |
↳ spreadsheetId | string | The ID of the spreadsheet |
↳ spreadsheetUrl | string | URL to access the spreadsheet |
Apply fill color and/or font formatting to a range in a Microsoft Excel worksheet
| Parameter | Type | Required | Description |
|---|
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
spreadsheetId | string | Yes | The ID of the spreadsheet/workbook (e.g., "01ABC123DEF456") |
driveId | string | No | The ID of the drive containing the spreadsheet. Required for SharePoint files. If omitted, uses the signed-in user’s default OneDrive. Excel workbook APIs require a business account. |
sheetName | string | No | The name of the worksheet (e.g., "Sheet1"). If omitted, the range must use the combined "Sheet1!A1:B2" format. |
range | string | Yes | The cell range to format (e.g., "A1:D10" or "Sheet1!A1:D10") |
fillColor | string | No | Background fill color as an HTML hex code (e.g., "#FFFF00"). |
fontBold | boolean | No | Whether the font is bold. |
fontItalic | boolean | No | Whether the font is italic. |
fontColor | string | No | Font color as an HTML hex code (e.g., "#FF0000"). |
fontSize | number | No | Font size in points (e.g., 12). |
fontUnderline | string | No | None, Single, Double, SingleAccountant, or DoubleAccountant. |
fontName | string | No | Font name (e.g., "Calibri"). |
| Parameter | Type | Description |
|---|
formatted | boolean | Whether the formatting was applied |
range | string | The range that was formatted |
fill | object | The applied fill, or null if no fill was set |
↳ color | string | The applied fill color |
font | object | The applied font properties, or null if no font was set |
↳ bold | boolean | Whether the font is bold |
↳ italic | boolean | Whether the font is italic |
↳ color | string | The font color |
↳ name | string | The font name |
↳ underline | string | Underline style. |
↳ size | number | The font size in points |
metadata | object | Spreadsheet metadata |
↳ spreadsheetId | string | The ID of the spreadsheet |
↳ spreadsheetUrl | string | URL to access the spreadsheet |
Create a new table over a range of cells in a Microsoft Excel workbook
| Parameter | Type | Required | Description |
|---|
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
spreadsheetId | string | Yes | The ID of the spreadsheet/workbook (e.g., "01ABC123DEF456") |
driveId | string | No | The ID of the drive containing the spreadsheet. Required for SharePoint files. If omitted, uses the signed-in user’s default OneDrive. Excel workbook APIs require a business account. |
address | string | Yes | The range address for the table data source (e.g., "Sheet1!A1:D5"). If no sheet name is included, the active sheet is used. |
hasHeaders | boolean | No | Whether the first row of the range contains column headers. Defaults to true. |
| Parameter | Type | Description |
|---|
metadata | object | Spreadsheet metadata |
↳ spreadsheetId | string | The ID of the spreadsheet |
↳ spreadsheetUrl | string | URL to access the spreadsheet |
Delete a worksheet (sheet) from a Microsoft Excel workbook
| Parameter | Type | Required | Description |
|---|
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
spreadsheetId | string | Yes | The ID of the spreadsheet/workbook (e.g., "01ABC123DEF456") |
driveId | string | No | The ID of the drive containing the spreadsheet. Required for SharePoint files. If omitted, uses the signed-in user’s default OneDrive. Excel workbook APIs require a business account. |
worksheetName | string | Yes | The name of the worksheet to delete (e.g., "Sheet1", "Old Data") |
| Parameter | Type | Description |
|---|
deleted | boolean | Whether the worksheet was deleted |
worksheetName | string | The name of the deleted worksheet |
metadata | object | Spreadsheet metadata |
↳ spreadsheetId | string | The ID of the spreadsheet |
↳ spreadsheetUrl | string | URL to access the spreadsheet |
Sort a range or table by one or more fields in a Microsoft Excel worksheet
| Parameter | Type | Required | Description |
|---|
sortFields | array | No | Sort conditions [{key, ascending, sortOn, color, dataOption, icon}]. Overrides sortColumn/sortAscending; ascending defaults to true for each condition; key is a zero-based offset, sortOn is Value, CellColor, FontColor, or Icon; dataOption is Normal or TextAsNumber; icon contains set and index. |
sortMethod | string | No | Chinese character ordering: PinYin or StrokeCount. |
orientation | string | No | Rows (default) or Columns. Applies only to range sorts. |
sessionId | string | No | Workbook session ID from Create Session. Omit for a sessionless request that saves changes. |
spreadsheetId | string | Yes | The ID of the spreadsheet/workbook (e.g., "01ABC123DEF456") |
driveId | string | No | The ID of the drive containing the spreadsheet. Required for SharePoint files. If omitted, uses the signed-in user’s default OneDrive. Excel workbook APIs require a business account. |
tableName | string | No | The name of the table to sort. When provided, the table is sorted and range/sheetName are ignored. |
sheetName | string | No | The name of the worksheet (e.g., "Sheet1"). Used for range sorts when the range does not include a sheet name. |
range | string | No | The cell range to sort (e.g., "A1:D10" or "Sheet1!A1:D10"). Required when no table name is provided. |
sortColumn | number | No | Zero-based sort key: column offset for Rows orientation, row offset for Columns orientation. |
sortAscending | boolean | No | Whether to sort in ascending order. Defaults to true. |
hasHeaders | boolean | No | Whether the range has a header row that should be excluded from sorting. Only applies to range sorts. Defaults to false. |
matchCase | boolean | No | Whether casing affects string ordering. Defaults to false. |
| Parameter | Type | Description |
|---|
sorted | boolean | Whether the sort was applied |
target | string | The range or table name that was sorted |
sortColumn | number | The zero-based key of the first sort condition |
ascending | boolean | Whether the sort was ascending |
metadata | object | Spreadsheet metadata |
↳ spreadsheetId | string | The ID of the spreadsheet |
↳ spreadsheetUrl | string | URL to access the spreadsheet |