What can you do with it?
Microsoft Excel integration allows you to programmatically manage spreadsheets and data through the Microsoft Graph API. You can create workbooks, search for Excel files, manage worksheets, read and write cell data, insert formulas, apply formatting, work with tables including adding, updating and deleting rows, and perform data operations like filtering and sorting. This integration is perfect for automated reporting, data processing workflows, spreadsheet management, converting CSV/JSON to Excel, and building data-driven applications that interact with Excel files stored in OneDrive for Business or SharePoint.How to use it?
Basic Command Structure
Parameters
Required:action- The operation to perform with Excel
Workbook Operations
Create Workbook
Create a new Excel workbook in OneDrive/SharePoint Parameters:filename(required) - Name for the new workbook (e.g., “Sales Report.xlsx”)
Search Excel Files
Find Excel files by name to obtain workbook ID Parameters:filename(required) - Name or partial name of the Excel file
List Workbooks
Get all Excel workbooks from root or specific folder Parameters:folder-id(optional) - Folder ID to search within (searches root if omitted)
Get Workbook Metadata
Get detailed information about a workbook Parameters:workbook-id(required) - The ID of the Excel workbook
Delete Workbook
Permanently delete an Excel workbook Parameters:workbook-id(required) - The ID of the Excel workbook
Worksheet Operations
List Worksheets
Get all worksheets in a workbook Parameters:workbook-id(required) - The ID of the Excel workbook
Create Worksheet
Add a new worksheet to a workbook Parameters:workbook-id(required) - The ID of the Excel workbooksheet-name(required) - Name for the new worksheet
Get Specific Worksheet
Get worksheet details by name or ID Parameters:workbook-id(required) - The ID of the Excel workbookworksheet-id(required) - The ID or name of the worksheet
Rename Worksheet
Change worksheet name or position Parameters:workbook-id(required) - The ID of the Excel workbookworksheet-id(required) - The current ID or name of the worksheetnew-name(optional) - New name for the worksheetposition(optional) - New position index
Delete Worksheet
Remove a worksheet from a workbook Parameters:workbook-id(required) - The ID of the Excel workbookworksheet-id(required) - The ID or name of the worksheet to delete
Data Operations
Read Data from Range
Read cell values from a worksheet Parameters:workbook-id(required) - The ID of the Excel workbookworksheet-id(required) - The ID or name of the worksheetcell-range(optional) - Cell range (e.g., A1:D10, A1). Omit to read entire used range
Write Data to Range
Write values to cells in a worksheet Parameters:workbook-id(required) - The ID of the Excel workbookworksheet-id(required) - The ID or name of the worksheetcell-range(required) - Starting cell address (e.g., A1)values(required) - 2D array of values to write
Write Formulas
Insert Excel formulas into cells Parameters:workbook-id(required) - The ID of the Excel workbookworksheet-id(required) - The ID or name of the worksheetcell-range(required) - Cell address for the formulaformula(required) - Formula string starting with ”=”
Convert CSV/JSON to Excel
Create Excel files from CSV or JSON data Parameters:filename(required) - Name for the new Excel filedata(required) - CSV string or JSON array to convertdata-type(required) - Either “csv” or “json”
Formatting Operations
Format Range - Font Styling
Apply font properties to cells Parameters:workbook-id(required) - The ID of the Excel workbookworksheet-id(required) - The ID or name of the worksheetcell-range(required) - Range to format (e.g., A1:D1)bold(optional) - true/falseitalic(optional) - true/falsesize(optional) - Font size (e.g., 12)color(optional) - Hex color code (e.g., “#FF0000”)font-name(optional) - Font name (e.g., “Calibri”)
Format Range - Fill Color
Apply background color to cells Parameters:workbook-id(required) - The ID of the Excel workbookworksheet-id(required) - The ID or name of the worksheetcell-range(required) - Range to formatcolor(required) - Hex color code (e.g., “#4472C4”)
Format Range - Borders
Add borders to cells Parameters:workbook-id(required) - The ID of the Excel workbookworksheet-id(required) - The ID or name of the worksheetcell-range(required) - Range to formatcolor(optional) - Hex color code (default: “#000000”)style(optional) - Border style: “Continuous”, “Dash”, “DashDot”, “DashDotDot”, “Dot”, “Double”, “None”weight(optional) - Border weight: “Thin”, “Medium”, “Thick”
Format Range - Number Format
Apply number formatting to cells Parameters:workbook-id(required) - The ID of the Excel workbookworksheet-id(required) - The ID or name of the worksheetcell-range(required) - Range to formatnumber-format(required) - Format string (e.g., ”$#,##0.00” for currency, “0.00%” for percentage)
- Currency:
$#,##0.00 - Percentage:
0.00% - Date:
mm/dd/yyyy - Time:
h:mm:ss AM/PM - Accounting:
_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_) - Custom:
0.000,#,##0,yyyy-mm-dd
Format Range - Alignment
Set text alignment in cells Parameters:workbook-id(required) - The ID of the Excel workbookworksheet-id(required) - The ID or name of the worksheetcell-range(required) - Range to formathorizontal-alignment(optional) - “Left”, “Center”, “Right”, “Justify”, “Distributed”vertical-alignment(optional) - “Top”, “Middle”, “Bottom”, “Justify”, “Distributed”wrap-text(optional) - true/false
Combined Format Update
Apply multiple format properties at once (more efficient than separate calls) Parameters:workbook-id(required) - The ID of the Excel workbookworksheet-id(required) - The ID or name of the worksheetcell-range(required) - Range to format- Multiple formatting parameters from font, fill, number format, and alignment
Table Operations
Create Table
Convert a range to an Excel Table with headers Parameters:workbook-id(required) - The ID of the Excel workbookworksheet-id(required) - The ID or name of the worksheettable-range(required) - Range for the table (e.g., A1:D10)has-headers(optional) - Whether first row contains headers (default: true)
Add Table Row
Insert a new row into an Excel Table Parameters:workbook-id(required) - The ID of the Excel workbooktable-id(required) - The ID of the tablerow-data(required) - Array of values for the new row
Update Table Row
Modify an existing table row Parameters:workbook-id(required) - The ID of the Excel workbooktable-id(required) - The ID of the tablerow-index(required) - 0-based index within table (excluding header)row-data(required) - Array of new values
Delete Table Row
Remove a row from a table Parameters:workbook-id(required) - The ID of the Excel workbooktable-id(required) - The ID of the tablerow-index(required) - 0-based index of row to delete
Get Table Data
Read all rows from a table Parameters:workbook-id(required) - The ID of the Excel workbooktable-id(required) - The ID of the table
Filter Table Data
Apply filter criteria to table columns Parameters:workbook-id(required) - The ID of the Excel workbooktable-id(required) - The ID of the tablecolumn-id(required) - Column index or name to filterfilter-criteria(required) - Filter specification (varies by filter type)
Sort Table Data
Sort table by one or more columns Parameters:workbook-id(required) - The ID of the Excel workbooktable-id(required) - The ID of the tablesort-fields(required) - Array of sort specifications with key (column index) and ascending (true/false)
Best Practices
- Authorization: Requires Files.Read for read operations, Files.ReadWrite for write operations
- Workbook ID: Always obtain workbook-id first using search or list operations
- URL Encoding: Encode special characters in sheet names and worksheet IDs
- Data Format: Ensure all rows in 2D arrays have same column count (pad with null if needed)
- Formulas: Write formulas as strings starting with ”=”, they auto-calculate when written
- Formatting: Apply formatting after writing data for better performance
- Error Handling: Check for ItemNotFound (404) and AccessDenied (403) errors
Storage and File Support
Storage Support:- OneDrive for Business: ✓ Supported
- SharePoint: ✓ Supported
- OneDrive Consumer: ✗ Not supported
- .xlsx (Office Open XML): ✓ Supported
- .xls: ✗ Not supported

