Skip to main content

Overview

Enable your agents to create and manage Excel workbooks, worksheets, tables, and charts in OneDrive or SharePoint. Manipulate data ranges, create visualizations, manage tables, and streamline your spreadsheet workflows with AI-powered automation.

Prerequisites

Before using the Microsoft Excel integration, ensure you have:
  • A CrewAI AMP account with an active subscription
  • A Microsoft 365 account with Excel and OneDrive/SharePoint access
  • Connected your Microsoft account through the Integrations page

Setting Up Microsoft Excel Integration

1. Connect Your Microsoft Account

  1. Navigate to CrewAI AMP Integrations
  2. Find Microsoft Excel in the Authentication Integrations section
  3. Click Connect and complete the OAuth flow
  4. Grant the necessary permissions for files and Excel workbook access
  5. Copy your Enterprise Token from Integration Settings

2. Install Required Package

3. Environment Variable Setup

To use integrations with Agent(apps=[]), you must set the CREWAI_PLATFORM_INTEGRATION_TOKEN environment variable with your Enterprise Token.
Or add it to your .env file:

Available Actions

Description: Create a new Excel workbook in OneDrive or SharePoint.Parameters:
  • file_path (string, required): Path where to create the workbook (e.g., ‘MyWorkbook.xlsx’)
  • worksheets (array, optional): Initial worksheets to create
Description: Get all Excel workbooks from OneDrive or SharePoint.Parameters:
  • select (string, optional): Select specific properties to return
  • filter (string, optional): Filter results using OData syntax
  • expand (string, optional): Expand related resources inline
  • top (integer, optional): Number of items to return. Minimum: 1, Maximum: 999
  • orderby (string, optional): Order results by specified properties
Description: Get all worksheets in an Excel workbook.Parameters:
  • file_id (string, required): The ID of the Excel file
  • select (string, optional): Select specific properties to return (e.g., ‘id,name,position’)
  • filter (string, optional): Filter results using OData syntax
  • expand (string, optional): Expand related resources inline
  • top (integer, optional): Number of items to return. Minimum: 1, Maximum: 999
  • orderby (string, optional): Order results by specified properties
Description: Create a new worksheet in an Excel workbook.Parameters:
  • file_id (string, required): The ID of the Excel file
  • name (string, required): Name of the new worksheet
Description: Get data from a specific range in an Excel worksheet.Parameters:
  • file_id (string, required): The ID of the Excel file
  • worksheet_name (string, required): Name of the worksheet
  • range (string, required): Range address (e.g., ‘A1:C10’)
Description: Update data in a specific range in an Excel worksheet.Parameters:
  • file_id (string, required): The ID of the Excel file
  • worksheet_name (string, required): Name of the worksheet
  • range (string, required): Range address (e.g., ‘A1:C10’)
  • values (array, required): 2D array of values to set in the range
Description: Create a table in an Excel worksheet.Parameters:
  • file_id (string, required): The ID of the Excel file
  • worksheet_name (string, required): Name of the worksheet
  • range (string, required): Range for the table (e.g., ‘A1:D10’)
  • has_headers (boolean, optional): Whether the first row contains headers. Default: true
Description: Get all tables in an Excel worksheet.Parameters:
  • file_id (string, required): The ID of the Excel file
  • worksheet_name (string, required): Name of the worksheet
Description: Add a new row to an Excel table.Parameters:
  • file_id (string, required): The ID of the Excel file
  • worksheet_name (string, required): Name of the worksheet
  • table_name (string, required): Name of the table
  • values (array, required): Array of values for the new row
Description: Get data from a specific table in an Excel worksheet.Parameters:
  • file_id (string, required): The ID of the Excel file
  • worksheet_name (string, required): Name of the worksheet
  • table_name (string, required): Name of the table
Description: Create a chart in an Excel worksheet.Parameters:
  • file_id (string, required): The ID of the Excel file
  • worksheet_name (string, required): Name of the worksheet
  • chart_type (string, required): Type of chart (e.g., ‘ColumnClustered’, ‘Line’, ‘Pie’)
  • source_data (string, required): Range of data for the chart (e.g., ‘A1:B10’)
  • series_by (string, optional): How to interpret the data (‘Auto’, ‘Columns’, or ‘Rows’). Default: Auto
Description: Get the value of a single cell in an Excel worksheet.Parameters:
  • file_id (string, required): The ID of the Excel file
  • worksheet_name (string, required): Name of the worksheet
  • row (integer, required): Row number (0-based)
  • column (integer, required): Column number (0-based)
Description: Get the used range of an Excel worksheet (contains all data).Parameters:
  • file_id (string, required): The ID of the Excel file
  • worksheet_name (string, required): Name of the worksheet
Description: Get the used range metadata (dimensions only, no data) of an Excel worksheet.Parameters:
  • file_id (string, required): The ID of the Excel file
  • worksheet_name (string, required): Name of the worksheet
Description: Get all charts in an Excel worksheet.Parameters:
  • file_id (string, required): The ID of the Excel file
  • worksheet_name (string, required): Name of the worksheet
Description: Delete a worksheet from an Excel workbook.Parameters:
  • file_id (string, required): The ID of the Excel file
  • worksheet_name (string, required): Name of the worksheet to delete
Description: Delete a table from an Excel worksheet.Parameters:
  • file_id (string, required): The ID of the Excel file
  • worksheet_name (string, required): Name of the worksheet
  • table_name (string, required): Name of the table to delete
Description: Get all named ranges in an Excel workbook.Parameters:
  • file_id (string, required): The ID of the Excel file

Usage Examples

Basic Excel Agent Setup

Data Analysis and Reporting

Workbook Creation and Structure

Data Manipulation and Updates

Advanced Excel Automation

Financial Modeling and Analysis

Troubleshooting

Common Issues

Permission Errors
  • Ensure your Microsoft account has appropriate permissions for Excel and OneDrive/SharePoint
  • Verify that the OAuth connection includes required scopes (Files.Read.All, Files.ReadWrite.All)
  • Check that you have access to the specific workbooks you’re trying to modify
File ID and Path Issues
  • Verify that file IDs are correct and files exist in your OneDrive or SharePoint
  • Ensure file paths are properly formatted when creating new workbooks
  • Check that workbook files have the correct .xlsx extension
Worksheet and Range Issues
  • Verify that worksheet names exist in the specified workbook
  • Ensure range addresses are properly formatted (e.g., ‘A1:C10’)
  • Check that ranges don’t exceed worksheet boundaries
Data Format Issues
  • Ensure data values are properly formatted for Excel (strings, numbers, integers)
  • Verify that 2D arrays for ranges have consistent row and column counts
  • Check that table data includes proper headers when has_headers is true
Chart Creation Issues
  • Verify that chart types are supported (ColumnClustered, Line, Pie, etc.)
  • Ensure source data ranges contain appropriate data for the chart type
  • Check that the source data range exists and contains data
Table Management Issues
  • Ensure table names are unique within worksheets
  • Verify that table ranges don’t overlap with existing tables
  • Check that new row data matches the table’s column structure
Cell and Range Operations
  • Verify that row and column indices are 0-based for cell operations
  • Ensure ranges contain data when using get_used_range
  • Check that named ranges exist before referencing them

Getting Help

Need Help?

Contact our support team for assistance with Microsoft Excel integration setup or troubleshooting.