Microsoft Excel

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.

Usage Instructions

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.

Actions

Add to Microsoft Excel Table

Add new rows to a Microsoft Excel table

Input

ParameterTypeRequiredDescription
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
spreadsheetIdstringYesThe ID of the spreadsheet/workbook containing the table (e.g., "01ABC123DEF456")
driveIdstringNoThe 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.
tableNamestringYesThe name of the table to add rows to (e.g., "Table1", "SalesTable")
indexnumberNoZero-based insertion index. Omit to append at the end.
valuesarrayNoData 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.

Output

ParameterTypeDescription
indexnumberIndex of the first row that was added
metadataobjectSpreadsheet metadata
↳ spreadsheetIdstringThe ID of the spreadsheet
↳ spreadsheetUrlstringURL to access the spreadsheet

Add Worksheet to Microsoft Excel

Create a new worksheet (sheet) in a Microsoft Excel workbook

Input

ParameterTypeRequiredDescription
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
spreadsheetIdstringYesThe ID of the Excel workbook to add the worksheet to (e.g., "01ABC123DEF456")
driveIdstringNoThe 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.
worksheetNamestringNoThe 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

Output

ParameterTypeDescription
worksheetobjectDetails of the newly created worksheet
↳ idstringThe unique ID of the worksheet
↳ namestringThe name of the worksheet
↳ positionnumberThe zero-based position of the worksheet
↳ visibilitystringThe visibility state of the worksheet (Visible/Hidden/VeryHidden)
metadataobjectSpreadsheet metadata
↳ spreadsheetIdstringThe ID of the spreadsheet
↳ spreadsheetUrlstringURL to access the spreadsheet

Microsoft Excel List Worksheets

List Worksheets in a Microsoft Excel workbook.

Input

ParameterTypeRequiredDescription
spreadsheetIdstringYesWorkbook drive item ID.
driveIdstringNoDrive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account.
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
topnumberNoPage size ($top), from 1 to 1000. Defaults to 100.
skipnumberNoNumber of items to skip ($skip). Defaults to 0. Increase by the returned count to read the next page.

Output

ParameterTypeDescription
worksheetsarrayWorksheets in this page.

Microsoft Excel Get Worksheet

Get Worksheet in a Microsoft Excel workbook.

Input

ParameterTypeRequiredDescription
spreadsheetIdstringYesWorkbook drive item ID.
driveIdstringNoDrive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account.
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
sheetNamestringYesWorksheet ID or name within the workbook.

Output

ParameterTypeDescription
addressLocalstringRange property: addressLocal
cellCountnumberRange property: cellCount
columnCountnumberRange property: columnCount
columnHiddenbooleanRange property: columnHidden
columnIndexnumberRange property: columnIndex
formulasjsonTwo-dimensional cell matrix: formulas
formulasLocaljsonTwo-dimensional cell matrix: formulasLocal
formulasR1C1jsonTwo-dimensional cell matrix: formulasR1C1
hiddenbooleanRange property: hidden
numberFormatjsonTwo-dimensional cell matrix: numberFormat
rowCountnumberRange property: rowCount
rowHiddenbooleanRange property: rowHidden
rowIndexnumberRange property: rowIndex
textjsonTwo-dimensional cell matrix: text
valueTypesjsonTwo-dimensional cell matrix: valueTypes
worksheetjsonWorksheet properties (id, name, position, visibility)
worksheetsjsonWorksheet page [{id, name, position, visibility}]
tablesjsonTable page with IDs, names, styles, header/totals visibility, and formatting flags
rowsjsonTable row page [{index, values}]
indexnumberZero-based table row index
nextLinkstringProvider continuation link when returned
countnumberNumber of items returned in this page
sessionIdstringCreated workbook session ID
persistChangesbooleanWhether session changes are saved
closedbooleanWhether the session was closed
refreshedbooleanWhether the session was refreshed
calculatedbooleanWhether workbook calculation completed
sheetNamestringName of the sheet
rangestringRange that was read
valuesjsonCell values as a two-dimensional array
updatedRangestringUpdated range
updatedRowsnumberUpdated rows count
updatedColumnsnumberUpdated columns count
updatedCellsnumberUpdated cells count
clearedbooleanWhether the range was cleared
applyTostringWhat was cleared (All, Contents, or Formats)
formattedbooleanWhether the formatting was applied
filljsonApplied fill ({color}) or null
fontjsonApplied font ({bold, italic, color, name, size}) or null
tablejsonCreated table ({id, name, showHeaders, showTotals, style})
deletedbooleanWhether the worksheet, table, or row was deleted
worksheetNamestringName of the deleted worksheet
sortedbooleanWhether the sort was applied
targetstringThe range or table name that was sorted
metadatajsonSpreadsheet metadata including ID and URL

Microsoft Excel Update Worksheet

Update Worksheet in a Microsoft Excel workbook.

Input

ParameterTypeRequiredDescription
spreadsheetIdstringYesWorkbook drive item ID.
driveIdstringNoDrive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account.
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
sheetNamestringYesWorksheet ID or name within the workbook.
namestringNoNew worksheet name, unique within the workbook (maximum 31 characters).
positionnumberNoNew zero-based worksheet position.
visibilitystringNoVisible, Hidden, or VeryHidden.

Output

ParameterTypeDescription
addressLocalstringRange property: addressLocal
cellCountnumberRange property: cellCount
columnCountnumberRange property: columnCount
columnHiddenbooleanRange property: columnHidden
columnIndexnumberRange property: columnIndex
formulasjsonTwo-dimensional cell matrix: formulas
formulasLocaljsonTwo-dimensional cell matrix: formulasLocal
formulasR1C1jsonTwo-dimensional cell matrix: formulasR1C1
hiddenbooleanRange property: hidden
numberFormatjsonTwo-dimensional cell matrix: numberFormat
rowCountnumberRange property: rowCount
rowHiddenbooleanRange property: rowHidden
rowIndexnumberRange property: rowIndex
textjsonTwo-dimensional cell matrix: text
valueTypesjsonTwo-dimensional cell matrix: valueTypes
worksheetjsonWorksheet properties (id, name, position, visibility)
worksheetsjsonWorksheet page [{id, name, position, visibility}]
tablesjsonTable page with IDs, names, styles, header/totals visibility, and formatting flags
rowsjsonTable row page [{index, values}]
indexnumberZero-based table row index
nextLinkstringProvider continuation link when returned
countnumberNumber of items returned in this page
sessionIdstringCreated workbook session ID
persistChangesbooleanWhether session changes are saved
closedbooleanWhether the session was closed
refreshedbooleanWhether the session was refreshed
calculatedbooleanWhether workbook calculation completed
sheetNamestringName of the sheet
rangestringRange that was read
valuesjsonCell values as a two-dimensional array
updatedRangestringUpdated range
updatedRowsnumberUpdated rows count
updatedColumnsnumberUpdated columns count
updatedCellsnumberUpdated cells count
clearedbooleanWhether the range was cleared
applyTostringWhat was cleared (All, Contents, or Formats)
formattedbooleanWhether the formatting was applied
filljsonApplied fill ({color}) or null
fontjsonApplied font ({bold, italic, color, name, size}) or null
tablejsonCreated table ({id, name, showHeaders, showTotals, style})
deletedbooleanWhether the worksheet, table, or row was deleted
worksheetNamestringName of the deleted worksheet
sortedbooleanWhether the sort was applied
targetstringThe range or table name that was sorted
metadatajsonSpreadsheet metadata including ID and URL

Microsoft Excel List Tables

List Tables in a Microsoft Excel workbook.

Input

ParameterTypeRequiredDescription
spreadsheetIdstringYesWorkbook drive item ID.
driveIdstringNoDrive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account.
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
topnumberNoPage size ($top), from 1 to 1000. Defaults to 100.
skipnumberNoNumber of items to skip ($skip). Defaults to 0. Increase by the returned count to read the next page.

Output

ParameterTypeDescription
tablesarrayTables in this page.

Microsoft Excel Get Table

Get Table in a Microsoft Excel workbook.

Input

ParameterTypeRequiredDescription
spreadsheetIdstringYesWorkbook drive item ID.
driveIdstringNoDrive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account.
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
tableNamestringYesTable ID or name within the workbook.

Output

ParameterTypeDescription
addressLocalstringRange property: addressLocal
cellCountnumberRange property: cellCount
columnCountnumberRange property: columnCount
columnHiddenbooleanRange property: columnHidden
columnIndexnumberRange property: columnIndex
formulasjsonTwo-dimensional cell matrix: formulas
formulasLocaljsonTwo-dimensional cell matrix: formulasLocal
formulasR1C1jsonTwo-dimensional cell matrix: formulasR1C1
hiddenbooleanRange property: hidden
numberFormatjsonTwo-dimensional cell matrix: numberFormat
rowCountnumberRange property: rowCount
rowHiddenbooleanRange property: rowHidden
rowIndexnumberRange property: rowIndex
textjsonTwo-dimensional cell matrix: text
valueTypesjsonTwo-dimensional cell matrix: valueTypes
worksheetjsonWorksheet properties (id, name, position, visibility)
worksheetsjsonWorksheet page [{id, name, position, visibility}]
tablesjsonTable page with IDs, names, styles, header/totals visibility, and formatting flags
rowsjsonTable row page [{index, values}]
indexnumberZero-based table row index
nextLinkstringProvider continuation link when returned
countnumberNumber of items returned in this page
sessionIdstringCreated workbook session ID
persistChangesbooleanWhether session changes are saved
closedbooleanWhether the session was closed
refreshedbooleanWhether the session was refreshed
calculatedbooleanWhether workbook calculation completed
sheetNamestringName of the sheet
rangestringRange that was read
valuesjsonCell values as a two-dimensional array
updatedRangestringUpdated range
updatedRowsnumberUpdated rows count
updatedColumnsnumberUpdated columns count
updatedCellsnumberUpdated cells count
clearedbooleanWhether the range was cleared
applyTostringWhat was cleared (All, Contents, or Formats)
formattedbooleanWhether the formatting was applied
filljsonApplied fill ({color}) or null
fontjsonApplied font ({bold, italic, color, name, size}) or null
tablejsonCreated table ({id, name, showHeaders, showTotals, style})
deletedbooleanWhether the worksheet, table, or row was deleted
worksheetNamestringName of the deleted worksheet
sortedbooleanWhether the sort was applied
targetstringThe range or table name that was sorted
metadatajsonSpreadsheet metadata including ID and URL

Microsoft Excel Update Table

Update Table in a Microsoft Excel workbook.

Input

ParameterTypeRequiredDescription
spreadsheetIdstringYesWorkbook drive item ID.
driveIdstringNoDrive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account.
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
tableNamestringYesTable ID or name within the workbook.
namestringNoNew unique table name.
showHeadersbooleanNoWhether to show the header row.
showTotalsbooleanNoWhether to show the totals row.
stylestringNoBuilt-in table style (TableStyleLight1–21, TableStyleMedium1–28, TableStyleDark1–11) or a custom style already in the workbook.

Output

ParameterTypeDescription
addressLocalstringRange property: addressLocal
cellCountnumberRange property: cellCount
columnCountnumberRange property: columnCount
columnHiddenbooleanRange property: columnHidden
columnIndexnumberRange property: columnIndex
formulasjsonTwo-dimensional cell matrix: formulas
formulasLocaljsonTwo-dimensional cell matrix: formulasLocal
formulasR1C1jsonTwo-dimensional cell matrix: formulasR1C1
hiddenbooleanRange property: hidden
numberFormatjsonTwo-dimensional cell matrix: numberFormat
rowCountnumberRange property: rowCount
rowHiddenbooleanRange property: rowHidden
rowIndexnumberRange property: rowIndex
textjsonTwo-dimensional cell matrix: text
valueTypesjsonTwo-dimensional cell matrix: valueTypes
worksheetjsonWorksheet properties (id, name, position, visibility)
worksheetsjsonWorksheet page [{id, name, position, visibility}]
tablesjsonTable page with IDs, names, styles, header/totals visibility, and formatting flags
rowsjsonTable row page [{index, values}]
indexnumberZero-based table row index
nextLinkstringProvider continuation link when returned
countnumberNumber of items returned in this page
sessionIdstringCreated workbook session ID
persistChangesbooleanWhether session changes are saved
closedbooleanWhether the session was closed
refreshedbooleanWhether the session was refreshed
calculatedbooleanWhether workbook calculation completed
sheetNamestringName of the sheet
rangestringRange that was read
valuesjsonCell values as a two-dimensional array
updatedRangestringUpdated range
updatedRowsnumberUpdated rows count
updatedColumnsnumberUpdated columns count
updatedCellsnumberUpdated cells count
clearedbooleanWhether the range was cleared
applyTostringWhat was cleared (All, Contents, or Formats)
formattedbooleanWhether the formatting was applied
filljsonApplied fill ({color}) or null
fontjsonApplied font ({bold, italic, color, name, size}) or null
tablejsonCreated table ({id, name, showHeaders, showTotals, style})
deletedbooleanWhether the worksheet, table, or row was deleted
worksheetNamestringName of the deleted worksheet
sortedbooleanWhether the sort was applied
targetstringThe range or table name that was sorted
metadatajsonSpreadsheet metadata including ID and URL

Microsoft Excel Delete Table

Delete Table in a Microsoft Excel workbook.

Input

ParameterTypeRequiredDescription
spreadsheetIdstringYesWorkbook drive item ID.
driveIdstringNoDrive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account.
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
tableNamestringYesTable ID or name within the workbook.

Output

ParameterTypeDescription
deletedbooleanWhether the table was deleted.

Microsoft Excel List Table Rows

List Table Rows in a Microsoft Excel workbook.

Input

ParameterTypeRequiredDescription
spreadsheetIdstringYesWorkbook drive item ID.
driveIdstringNoDrive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account.
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
topnumberNoPage size ($top), from 1 to 1000. Defaults to 100.
skipnumberNoNumber of items to skip ($skip). Defaults to 0. Increase by the returned count to read the next page.
tableNamestringYesTable ID or name within the workbook.

Output

ParameterTypeDescription
rowsarrayTable Rows in this page.

Microsoft Excel Get Table Row

Get Table Row in a Microsoft Excel workbook.

Input

ParameterTypeRequiredDescription
spreadsheetIdstringYesWorkbook drive item ID.
driveIdstringNoDrive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account.
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
tableNamestringYesTable ID or name within the workbook.
indexnumberYesZero-based table row index. Indexes can change when rows are inserted or deleted.

Output

ParameterTypeDescription
indexnumberZero-based table row index.

Microsoft Excel Update Table Row

Update Table Row in a Microsoft Excel workbook.

Input

ParameterTypeRequiredDescription
spreadsheetIdstringYesWorkbook drive item ID.
driveIdstringNoDrive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account.
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
tableNamestringYesTable ID or name within the workbook.
indexnumberYesZero-based table row index. Indexes can change when rows are inserted or deleted.
valuesarrayYesExactly one row as a two-dimensional array, in table column order. Use null to leave a cell unchanged.

Output

ParameterTypeDescription
indexnumberZero-based table row index.

Microsoft Excel Delete Table Row

Delete Table Row in a Microsoft Excel workbook.

Input

ParameterTypeRequiredDescription
spreadsheetIdstringYesWorkbook drive item ID.
driveIdstringNoDrive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account.
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
tableNamestringYesTable ID or name within the workbook.
indexnumberYesZero-based table row index. Indexes can change when rows are inserted or deleted.

Output

ParameterTypeDescription
deletedbooleanWhether the table row was deleted.

Microsoft Excel Create Session

Create Session in a Microsoft Excel workbook.

Input

ParameterTypeRequiredDescription
spreadsheetIdstringYesWorkbook drive item ID.
driveIdstringNoDrive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account.
persistChangesbooleanYesTrue saves changes; false creates a temporary workbook copy whose changes are discarded when the session ends.

Output

ParameterTypeDescription
sessionIdstringPass this ID as sessionId on subsequent workbook operations.
persistChangesbooleanWhether changes in this session are saved.

Microsoft Excel Refresh Session

Refresh Session in a Microsoft Excel workbook.

Input

ParameterTypeRequiredDescription
spreadsheetIdstringYesWorkbook drive item ID.
driveIdstringNoDrive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account.
sessionIdstringYesWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.

Output

ParameterTypeDescription
refreshedbooleanWhether the workbook session was refreshed.

Microsoft Excel Close Session

Close Session in a Microsoft Excel workbook.

Input

ParameterTypeRequiredDescription
spreadsheetIdstringYesWorkbook drive item ID.
driveIdstringNoDrive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account.
sessionIdstringYesWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.

Output

ParameterTypeDescription
closedbooleanWhether the workbook session was closed.

Microsoft Excel Calculate

Calculate in a Microsoft Excel workbook.

Input

ParameterTypeRequiredDescription
spreadsheetIdstringYesWorkbook drive item ID.
driveIdstringNoDrive ID for SharePoint or another drive. Defaults to the signed-in user’s OneDrive. Excel workbook APIs require a business account.
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
calculationTypestringYesRecalculate recalculates dirty cells; Full recalculates all cells; FullRebuild rebuilds dependencies and recalculates all cells.

Output

ParameterTypeDescription
calculatedbooleanWhether workbook calculation completed.

Read from Microsoft Excel V2

Read data from a specific sheet in a Microsoft Excel spreadsheet

Input

ParameterTypeRequiredDescription
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
spreadsheetIdstringYesThe ID of the spreadsheet/workbook to read from (e.g., "01ABC123DEF456")
driveIdstringNoThe 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.
sheetNamestringYesThe name of the sheet/tab to read from (e.g., "Sheet1", "Sales Data")
cellRangestringNoThe cell range to read (e.g., "A1:D10"). If not specified, reads the entire used range.

Output

ParameterTypeDescription
sheetNamestringName of the sheet that was read
rangestringThe range that was read
metadatajsonSpreadsheet metadata including ID and URL
↳ spreadsheetIdstringMicrosoft Excel spreadsheet ID
↳ spreadsheetUrlstringSpreadsheet URL

Write to Microsoft Excel V2

Write data to a specific sheet in a Microsoft Excel spreadsheet

Input

ParameterTypeRequiredDescription
formulasarrayNoA1-style formulas as a two-dimensional array. Null leaves a cell unchanged.
formulasLocalarrayNoA1-style formulas in the user locale as a two-dimensional array. Null leaves a cell unchanged.
formulasR1C1arrayNoR1C1-style formulas as a two-dimensional array. Null leaves a cell unchanged.
numberFormatarrayNoExcel number format codes as a two-dimensional array. Null leaves a cell unchanged.
columnHiddenbooleanNoHide all columns in the target range.
rowHiddenbooleanNoHide all rows in the target range.
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
spreadsheetIdstringYesThe ID of the spreadsheet/workbook to write to (e.g., "01ABC123DEF456")
driveIdstringNoThe 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.
sheetNamestringYesThe name of the sheet/tab to write to (e.g., "Sheet1", "Sales Data")
cellRangestringNoThe cell range to write to (e.g., "A1:D10", "A1"). Defaults to "A1" if not specified.
valuesarrayNoThe 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.

Output

ParameterTypeDescription
updatedRangestringRange of cells that were updated
updatedRowsnumberNumber of rows updated
updatedColumnsnumberNumber of columns updated
updatedCellsnumberNumber of cells updated
metadatajsonSpreadsheet metadata including ID and URL
↳ spreadsheetIdstringMicrosoft Excel spreadsheet ID
↳ spreadsheetUrlstringSpreadsheet URL

Clear Microsoft Excel Range

Clear the values and/or formatting of a range in a Microsoft Excel worksheet

Input

ParameterTypeRequiredDescription
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
spreadsheetIdstringYesThe ID of the spreadsheet/workbook (e.g., "01ABC123DEF456")
driveIdstringNoThe 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.
sheetNamestringNoThe name of the worksheet (e.g., "Sheet1"). If omitted, the range must use the combined "Sheet1!A1:B2" format.
rangestringYesThe cell range to clear (e.g., "A1:D10" or "Sheet1!A1:D10")
applyTostringNoWhat to clear: "All", "Formats", or "Contents". Defaults to "All".

Output

ParameterTypeDescription
clearedbooleanWhether the range was cleared
rangestringThe range that was cleared
applyTostringWhat was cleared (All, Formats, or Contents)
metadataobjectSpreadsheet metadata
↳ spreadsheetIdstringThe ID of the spreadsheet
↳ spreadsheetUrlstringURL to access the spreadsheet

Format Microsoft Excel Range

Apply fill color and/or font formatting to a range in a Microsoft Excel worksheet

Input

ParameterTypeRequiredDescription
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
spreadsheetIdstringYesThe ID of the spreadsheet/workbook (e.g., "01ABC123DEF456")
driveIdstringNoThe 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.
sheetNamestringNoThe name of the worksheet (e.g., "Sheet1"). If omitted, the range must use the combined "Sheet1!A1:B2" format.
rangestringYesThe cell range to format (e.g., "A1:D10" or "Sheet1!A1:D10")
fillColorstringNoBackground fill color as an HTML hex code (e.g., "#FFFF00").
fontBoldbooleanNoWhether the font is bold.
fontItalicbooleanNoWhether the font is italic.
fontColorstringNoFont color as an HTML hex code (e.g., "#FF0000").
fontSizenumberNoFont size in points (e.g., 12).
fontUnderlinestringNoNone, Single, Double, SingleAccountant, or DoubleAccountant.
fontNamestringNoFont name (e.g., "Calibri").

Output

ParameterTypeDescription
formattedbooleanWhether the formatting was applied
rangestringThe range that was formatted
fillobjectThe applied fill, or null if no fill was set
↳ colorstringThe applied fill color
fontobjectThe applied font properties, or null if no font was set
↳ boldbooleanWhether the font is bold
↳ italicbooleanWhether the font is italic
↳ colorstringThe font color
↳ namestringThe font name
↳ underlinestringUnderline style.
↳ sizenumberThe font size in points
metadataobjectSpreadsheet metadata
↳ spreadsheetIdstringThe ID of the spreadsheet
↳ spreadsheetUrlstringURL to access the spreadsheet

Create Microsoft Excel Table

Create a new table over a range of cells in a Microsoft Excel workbook

Input

ParameterTypeRequiredDescription
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
spreadsheetIdstringYesThe ID of the spreadsheet/workbook (e.g., "01ABC123DEF456")
driveIdstringNoThe 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.
addressstringYesThe range address for the table data source (e.g., "Sheet1!A1:D5"). If no sheet name is included, the active sheet is used.
hasHeadersbooleanNoWhether the first row of the range contains column headers. Defaults to true.

Output

ParameterTypeDescription
metadataobjectSpreadsheet metadata
↳ spreadsheetIdstringThe ID of the spreadsheet
↳ spreadsheetUrlstringURL to access the spreadsheet

Delete Microsoft Excel Worksheet

Delete a worksheet (sheet) from a Microsoft Excel workbook

Input

ParameterTypeRequiredDescription
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
spreadsheetIdstringYesThe ID of the spreadsheet/workbook (e.g., "01ABC123DEF456")
driveIdstringNoThe 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.
worksheetNamestringYesThe name of the worksheet to delete (e.g., "Sheet1", "Old Data")

Output

ParameterTypeDescription
deletedbooleanWhether the worksheet was deleted
worksheetNamestringThe name of the deleted worksheet
metadataobjectSpreadsheet metadata
↳ spreadsheetIdstringThe ID of the spreadsheet
↳ spreadsheetUrlstringURL to access the spreadsheet

Sort Microsoft Excel Range

Sort a range or table by one or more fields in a Microsoft Excel worksheet

Input

ParameterTypeRequiredDescription
sortFieldsarrayNoSort 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.
sortMethodstringNoChinese character ordering: PinYin or StrokeCount.
orientationstringNoRows (default) or Columns. Applies only to range sorts.
sessionIdstringNoWorkbook session ID from Create Session. Omit for a sessionless request that saves changes.
spreadsheetIdstringYesThe ID of the spreadsheet/workbook (e.g., "01ABC123DEF456")
driveIdstringNoThe 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.
tableNamestringNoThe name of the table to sort. When provided, the table is sorted and range/sheetName are ignored.
sheetNamestringNoThe name of the worksheet (e.g., "Sheet1"). Used for range sorts when the range does not include a sheet name.
rangestringNoThe cell range to sort (e.g., "A1:D10" or "Sheet1!A1:D10"). Required when no table name is provided.
sortColumnnumberNoZero-based sort key: column offset for Rows orientation, row offset for Columns orientation.
sortAscendingbooleanNoWhether to sort in ascending order. Defaults to true.
hasHeadersbooleanNoWhether the range has a header row that should be excluded from sorting. Only applies to range sorts. Defaults to false.
matchCasebooleanNoWhether casing affects string ordering. Defaults to false.

Output

ParameterTypeDescription
sortedbooleanWhether the sort was applied
targetstringThe range or table name that was sorted
sortColumnnumberThe zero-based key of the first sort condition
ascendingbooleanWhether the sort was ascending
metadataobjectSpreadsheet metadata
↳ spreadsheetIdstringThe ID of the spreadsheet
↳ spreadsheetUrlstringURL to access the spreadsheet