The /microsoft-excel
command enables you to work with Excel spreadsheets in OneDrive for Business and SharePoint. Perfect for:
- Managing worksheets
- Updating cell values
- Creating and modifying tables
- Searching for workbooks
- Analyzing spreadsheet data
Basic Usage
Use the command to interact with Excel files:
/microsoft-excel find file "LotsOfData.xlsx"
/microsoft-excel update cell A1 in Sheet1 to "New Value"
/microsoft-excel create table from A1 to D10 with headers
Key Features
File Operations
- Search for Excel files
- Get workbook IDs
- Access file metadata
- Open by path or ID
- Check last modified dates
Worksheet Management
- List all worksheets
- Create new worksheets
- Delete worksheets
- Rename worksheets
- Reorder worksheet positions
Cell Operations
- Update cell values
- Read cell data
- Work with ranges
- Batch updates
- Format preservation
Table Management
- Create tables
- Add/update/delete rows
- Filter table data
- Sort tables
- Access table properties
Example Commands
Find Excel File
/microsoft-excel search for file named "Sales Report"
List Worksheets
/microsoft-excel show all sheets in workbook ID 01HRDJMGPNAGXLOFE4URDYNKMBXOIES4BR
Create Worksheet
/microsoft-excel add new sheet named "Q4 Data" to workbook
Update Cell Value
/microsoft-excel set cell B2 in Sheet1 to "Updated Value"
Create Table
/microsoft-excel create table in Sheet1 from A1 to E20 with headers
Add Table Row
/microsoft-excel add row to table1 with values ["John", "Doe", "Sales", 50000]
File Access Methods
By ID
Use when you have the workbook ID:
/microsoft-excel access workbook 01HRDJMGPNAGXLOFE4URDYNKMBXOIES4BR
By Path
Use when you know the file location:
/microsoft-excel open file at path "/Documents/Reports/sales.xlsx"
Storage Support
Supported
- ✓ OneDrive for Business
- ✓ SharePoint
- ✓ Microsoft 365
Not Supported
- ✗ OneDrive Consumer
- ✗ Local files
- ✗ .xls format (only .xlsx)
Worksheet Operations
Properties
- name: Worksheet name
- position: Order in workbook (0-based)
- visibility: Visible/Hidden status
- id: Unique identifier
Actions
- Create new sheets
- Delete existing sheets
- Rename worksheets
- Change sheet order
- Hide/show sheets
Table Features
Creation Options
- Define range (e.g., A1:D10)
- Specify headers (true/false)
- Auto-expand capability
Table Operations
- Add rows: Insert new data
- Update rows: Modify existing data
- Delete rows: Remove data
- Filter: Apply data filters
- Sort: Order by columns
Best Practices
-
Always get workbook ID first
- Search by filename
- Store ID for future operations
-
URL encode special characters
- Worksheet IDs with brackets
- File paths with spaces
-
Handle permissions
- Files.Read for viewing
- Files.ReadWrite for editing
-
Error handling
- Check for session expiration
- Verify file access rights
Tips
- Use OneDrive for Business, not consumer version
- Work with .xlsx files only
- First row naming: avoid “headers” as variable name
- Include proper authorization
- Cache workbook IDs for efficiency
Responses are generated using AI and may contain mistakes.