Excel

Learn how to use Excel with Composio

Overview

SLUG: EXCEL

Description

Microsoft Excel is a powerful spreadsheet application for data analysis, calculations, and visualization, enabling users to organize and process data with formulas, charts, and pivot tables

Authentication Details

client_id
stringRequired
client_secret
stringRequired
oauth_redirect_uri
stringDefaults to https://backend.composio.dev/api/v1/auth-apps/add
scopes
stringDefaults to Files.ReadWrite,Sites.ReadWrite.All,offline_access,User.Read
bearer_token
string

Connecting to Excel

Create an auth config

Use the dashboard to create an auth config for the Excel toolkit. This allows you to connect multiple Excel accounts to Composio for agents to use.

1

Select App

Navigate to Excel.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Excel Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using OAuth2

1from composio import Composio
2
3# Replace these with your actual values
4excel_auth_config_id = "ac_YOUR_EXCEL_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/application
6
7composio = Composio()
8
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 connection_request = composio.connected_accounts.initiate(
12 user_id=user_id,
13 auth_config_id=auth_config_id,
14 )
15
16 print(
17 f"Visit this URL to authenticate Excel: {connection_request.redirect_url}"
18 )
19
20 # This will wait for the auth flow to be completed
21 connection_request.wait_for_connection(timeout=15)
22 return connection_request.id
23
24
25connection_id = authenticate_toolkit(user_id, excel_auth_config_id)
26
27# You can also verify the connection status using:
28connected_account = composio.connected_accounts.get(connection_id)
29print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Excel toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["EXCEL"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Add Table

Description

Create a table in a workbook using microsoft graph api.

Action Parameters

hasHeaders
booleanRequired
item_id
stringRequired
name
stringRequired
session_id
string
showTotals
booleanRequired
style
stringRequired
table_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Add Workbook Permission

Description

Tool to grant access to a workbook via invite. use when you need to share a specific workbook file with designated recipients and roles.

Action Parameters

expirationDateTime
string
item_id
stringRequired
message
string
password
string
recipients
arrayRequired
requireSignIn
boolean
retainInheritedPermissions
booleanDefaults to True
roles
arrayRequired
sendInvitation
booleanDefaults to True

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Excel Session

Description

Create a session for an excel workbook using microsoft graph api.

Action Parameters

item_id
stringRequired
persist_changes
booleanDefaults to True

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Insert Range

Description

Tool to insert a new cell range into a worksheet, shifting existing cells down or right. use when you need to create space for new content without overwriting.

Action Parameters

address
stringRequired
item_id
stringRequired
session_id
string
shift
stringRequired
worksheet_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Table Columns

Description

List columns in a table using microsoft graph api.

Action Parameters

item_id
stringRequired
session_id
string
table_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Add Chart

Description

Add a chart to a worksheet using microsoft graph api.

Action Parameters

item_id
stringRequired
seriesby
stringRequired
session_id
string
sourcedata
stringRequired
type
stringRequired
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Add SharePoint Worksheet

Description

Add a new worksheet to a sharepoint excel workbook using microsoft graph sites api.

Action Parameters

item_id
stringRequired
name
stringRequired
session_id
string
site_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Add Table Column

Description

Add a column to a table using microsoft graph api.

Action Parameters

index
integerRequired
item_id
stringRequired
session_id
string
table_id
stringRequired
values
arrayRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Add Table Row

Description

Add a row to a table using microsoft graph api.

Action Parameters

index
integer
item_id
stringRequired
session_id
string
table_id
stringRequired
values
arrayRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Add Worksheet

Description

Add a new worksheet to an excel workbook using microsoft graph api.

Action Parameters

item_id
stringRequired
name
stringRequired
session_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Apply Table Filter

Description

Apply a filter to a table column using microsoft graph api.

Action Parameters

column_id
stringRequired
criteria
objectRequired
item_id
stringRequired
session_id
string
table_id
stringRequired
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Apply Table Sort

Description

Apply a sort to a table using microsoft graph api.

Action Parameters

fields
arrayRequired
item_id
stringRequired
session_id
string
table_id
stringRequired
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Clear Range

Description

Tool to clear values, formats, or contents in a specified worksheet range. use when you need to reset cells before adding new data.

Action Parameters

address
stringRequired
applyTo
string
item_id
stringRequired
session_id
string
worksheet_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Clear Table Filter

Description

Clear a filter from a table column using microsoft graph api.

Action Parameters

column_id
stringRequired
item_id
stringRequired
session_id
string
table_id
stringRequired
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Close Excel Session

Description

Tool to close an existing excel workbook session. use when you need to explicitly end a persistent session to release workbook locks.

Action Parameters

item_id
stringRequired
session_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Convert Table To Range

Description

Convert a table to a range using microsoft graph api.

Action Parameters

item_id
stringRequired
session_id
string
table_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Workbook

Description

Tool to create a new workbook file at a specified drive path. use when uploading a new .xlsx file to onedrive.

Action Parameters

content
stringRequired
drive_id
stringDefaults to me
path
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Table Column

Description

Delete a column from a table using microsoft graph api.

Action Parameters

column_id
stringRequired
item_id
stringRequired
session_id
string
table_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Table Row

Description

Delete a row from a table using microsoft graph api.

Action Parameters

item_id
stringRequired
row_index
integerRequired
session_id
string
table_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Worksheet

Description

Tool to delete a worksheet from the workbook. use when cleaning up unused or temporary sheets after verifying no dependencies exist. example: "delete 'sheet2' after review."

Action Parameters

item_id
stringRequired
session_id
string
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Chart Axis

Description

Tool to retrieve a specific axis from a chart. use when you need properties like min, max, interval, and formatting of the chart axis.

Action Parameters

axis_type
stringRequired
chart_name
stringRequired
expand
string
item_id
stringRequired
select
string
session_id
string
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Chart Data Labels

Description

Tool to retrieve the data labels object of a chart. use when you need to inspect label settings like position, separator, and visibility flags after creating or updating a chart.

Action Parameters

chart_id
stringRequired
item_id
stringRequired
session_id
string
worksheet_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Chart Legend

Description

Tool to retrieve the legend object of a chart. use after creating or updating a chart when you need to inspect legend visibility and formatting.

Action Parameters

chart_name
stringRequired
expand
string
item_id
stringRequired
select
string
session_id
string
worksheet_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Range

Description

Get a range from a worksheet using microsoft graph api.

Action Parameters

address
stringRequired
item_id
stringRequired
session_id
string
worksheet_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get SharePoint Range

Description

Get a range from a worksheet in sharepoint using microsoft graph sites api.

Action Parameters

address
stringRequired
item_id
stringRequired
session_id
string
site_id
stringRequired
worksheet_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get SharePoint Worksheet

Description

Get a worksheet by name or id from a sharepoint excel workbook using microsoft graph sites api.

Action Parameters

item_id
stringRequired
session_id
string
site_id
stringRequired
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Table Column

Description

Tool to retrieve a specific column from a workbook table. use when you need to fetch column properties and data by its id or name.

Action Parameters

column_id
stringRequired
item_id
stringRequired
session_id
string
table_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get workbook

Description

Tool to retrieve the properties and relationships of a workbook. use when you need to inspect comments, names, tables, or worksheets.

Action Parameters

drive_id
stringRequired
expand
array
item_id
stringRequired
session_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Worksheet

Description

Get a worksheet by name or id from an excel workbook using microsoft graph api.

Action Parameters

item_id
stringRequired
session_id
string
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Charts

Description

List charts in a worksheet using microsoft graph api.

Action Parameters

item_id
stringRequired
session_id
string
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Chart Series

Description

Tool to list all data series in a chart. use when you need to enumerate chart series for further analysis.

Action Parameters

chart_name
stringRequired
item_id
stringRequired
session_id
string
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Comments

Description

Tool to list comments in an excel workbook. use when you need to retrieve all workbook comments via microsoft graph api.

Action Parameters

item_id
stringRequired
session_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Drive Files

Description

List files and folders in a drive root or specified path.

Action Parameters

drive_id
stringDefaults to me
path
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Named Items

Description

List named items in a workbook using microsoft graph api.

Action Parameters

item_id
stringRequired
session_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List SharePoint Tables

Description

List tables in a sharepoint worksheet using microsoft graph sites api.

Action Parameters

item_id
stringRequired
session_id
string
site_id
stringRequired
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List SharePoint Worksheets

Description

List worksheets in an excel workbook stored in sharepoint using microsoft graph sites api.

Action Parameters

item_id
stringRequired
session_id
string
site_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Tables

Description

List tables in a worksheet using microsoft graph api.

Action Parameters

item_id
stringRequired
session_id
string
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Table Rows

Description

List rows in a table using microsoft graph api.

Action Parameters

item_id
stringRequired
session_id
string
table_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Workbook Permissions

Description

Tool to list permissions set on the workbook file. use when you need to see which users or links have access to a specific excel file by supplying its drive and item ids. example: "list permissions for workbook with drive id 'b!abc123' and item id '0123456789abcdef'."

Action Parameters

$expand
string
$select
string
$skip
integer
$top
integer
drive_id
stringRequired
item_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Worksheets

Description

List worksheets in an excel workbook using microsoft graph api.

Action Parameters

item_id
stringRequired
session_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Merge Cells

Description

Merge cells in a worksheet range using microsoft graph api.

Action Parameters

across
boolean
item_id
stringRequired
range
stringRequired
session_id
string
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Protect Worksheet

Description

Tool to protect a worksheet using optional protection options. use when you need to prevent editing certain parts of a sheet before sharing. example: "protect 'sheet1' to lock formatting and sorting."

Action Parameters

item_id
stringRequired
options
object
session_id
string
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Sort Range

Description

Sort a range in a worksheet using microsoft graph api.

Action Parameters

fields
arrayRequired
item_id
stringRequired
range_type
stringRequired
session_id
string
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Chart

Description

Update a chart in a worksheet using microsoft graph api.

Action Parameters

chart_id
stringRequired
height
number
item_id
stringRequired
left
number
name
string
session_id
string
top
number
width
number
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Chart Legend

Description

Tool to update formatting or position of a chart legend. use when adjusting legend settings after confirming chart and worksheet exist.

Action Parameters

chart_id
stringRequired
item_id
stringRequired
overlay
boolean
position
string
session_id
string
visible
boolean
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Range

Description

Update a range in a worksheet using microsoft graph api.

Action Parameters

address
stringRequired
item_id
stringRequired
session_id
string
values
arrayRequired
worksheet_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update SharePoint Range

Description

Update a range in a sharepoint worksheet using microsoft graph sites api.

Action Parameters

address
stringRequired
item_id
stringRequired
session_id
string
site_id
stringRequired
values
arrayRequired
worksheet_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Table

Description

Update a table in a workbook using microsoft graph api.

Action Parameters

item_id
stringRequired
name
string
session_id
string
showHeaders
boolean
showTotals
boolean
style
string
table_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Worksheet

Description

Update worksheet properties (name, position) in an excel workbook using microsoft graph api.

Action Parameters

item_id
stringRequired
name
string
position
integer
session_id
string
worksheet
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired