Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Microsoft Excel

Scalekit connector
Open markdown

The Microsoft Excel connector lets your AI agent act in each user's Microsoft Excel account. Each user signs in to Microsoft Excel once, and Scalekit stores and refreshes their tokens, so your agent never handles credentials. It comes with 47 tools.

Tools
47
What they doRead · write · destructive
16 · 24 · 716 read24 write7 destructive
Users sign in with
OAuth app
Scalekit's or your own

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the Microsoft Excel connection

    In AgentKit > Connections, create a Microsoft Excel connection. The name you give it is the connection_name your code passes. See Configure connections.

    Scalekit credentials are available for Microsoft Excel, so you don't need to register an OAuth app. To show your own app on the consent screen, use your own credentials instead.

    Use your own OAuth app

    Register your Scalekit environment with the Microsoft Excel connector so Scalekit handles the authentication flow and token lifecycle for you. The connection name you create will be used to identify and invoke the connection programmatically. Then complete the configuration in your application as follows:

    1. Set up auth redirects

      • In Scalekit dashboard, go to AgentKit > Connections > Create Connection. Find Excel and click Create. Copy the redirect URI. It will look like https://<SCALEKIT_ENVIRONMENT_URL>/sso/v1/oauth/<CONNECTION_ID>/callback.

        Copy redirect URI from Scalekit dashboard

      • Sign into portal.azure.com and go to Microsoft Entra ID → App registrations → New registration.

      • Enter a name for your app.

      • Under Supported account types, select Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts.

      • Under Redirect URI, select Web and paste the redirect URI from step 1. Click Register.

        Register an application in Azure portal

    2. Get your client credentials

      • Go to Certificates & secrets → New client secret, set an expiry, and click Add. Copy the Value immediately.

      • From the Overview page, copy the Application (client) ID.

    3. Add credentials in Scalekit

      • In Scalekit dashboard, go to AgentKit > Connections and open the connection you created.

      • Enter your credentials:

        Add credentials in Scalekit dashboard

      • Click Save.

  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'microsoftexcel'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Microsoft Excel:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'microsoftexcel_export_to_pdf',
    toolInput: { item_id: '01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K' },
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user signs in once. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • microsoftexcel_calculate_functionInvoke any built-in Excel worksheet function (e.g.Read-only

    Calculate Excel Function

    Invoke any built-in Excel worksheet function (e.g. PMT, SUM, VLOOKUP, TEXTJOIN) directly against a workbook stored in OneDrive and return its computed result, without needing to write the formula into a cell first.

    Inputs

    argumentsobjectrequired
    Named arguments for the function, matching the function's parameter names. Example for pmt: {"rate": 0.045, "nper": 12, "pv": -1250}.
    function_namestringrequired
    The name of the Excel function to invoke, in lowercase (e.g. 'pmt', 'sum', 'vlookup').
    item_idstringrequired
    OneDrive item ID of the Excel (.xlsx) file.
    session_idstring
    Optional workbook session ID from createSession. When provided, sent as the workbook-session-id header.
  • microsoftexcel_export_to_pdfExport an Excel workbook stored in OneDrive to PDF format.Read-only

    Export Excel to PDF

    Export an Excel workbook stored in OneDrive to PDF format. Uses the Microsoft Graph OneDrive content endpoint with format=pdf query parameter. Returns the PDF binary content. The response may be a direct 200 with the PDF body or a 302 redirect to a download URL depending on file size.

    Inputs

    item_idstringrequired
    OneDrive item ID of the Excel (.xlsx) file to export. Example: '01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K'.
  • microsoftexcel_get_chart_imageRender an Excel chart to a base64-encoded image, useful for embedding a snapshot of the chart in a report, email, or dashboard without opening the workbook.Read-only

    Get Chart Image

    Render an Excel chart to a base64-encoded image, useful for embedding a snapshot of the chart in a report, email, or dashboard without opening the workbook.

    Inputs

    chart_idstringrequired
    Name or ID of the chart to render. Use List Charts to find it.
    item_idstringrequired
    OneDrive item ID of the Excel (.xlsx) file.
    worksheet_idstringrequired
    Worksheet name or GUID containing the chart.
    heightinteger
    Desired image height in pixels. Use 0 to keep the chart's natural height.
    session_idstring
    Optional workbook session ID from createSession. When provided, sent as the workbook-session-id header.
    widthinteger
    Desired image width in pixels. Use 0 to keep the chart's natural width.
  • microsoftexcel_get_named_itemRetrieve the definition of a single named item (named range or named formula) in an Excel workbook stored in OneDrive, by its name.Read-only

    Get Named Item

    Retrieve the definition of a single named item (named range or named formula) in an Excel workbook stored in OneDrive, by its name.

    Inputs

    item_idstringrequired
    OneDrive item ID of the Excel (.xlsx) file.
    namestringrequired
    The name of the named item to retrieve.
    session_idstring
    Optional workbook session ID from createSession. When provided, sent as the workbook-session-id header.
  • microsoftexcel_get_rangeRetrieve the values, formulas, format, and address of a cell range in an Excel worksheet stored in OneDrive.Read-only

    Get Excel Range

    Retrieve the values, formulas, format, and address of a cell range in an Excel worksheet stored in OneDrive. Specify the range using standard Excel notation (e.g., 'A1:C10' or 'B2'). Optionally accepts a workbook session ID.

    Inputs

    addressstringrequired
    Cell range address in Excel notation to retrieve. Examples: 'A1' for a single cell, 'A1:C10' for a multi-cell range, 'Sheet1!A1:B5' to target a specific sheet within the address.
    item_idstringrequired
    OneDrive item ID of the Excel (.xlsx) file. Example: '01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K'.
    worksheet_idstringrequired
    Worksheet name or GUID containing the range. Example: 'Sheet1' or '{00000000-0001-0000-0000-000000000000}'.
    session_idstring
    Optional workbook session ID from createSession. When provided, sent as the workbook-session-id header. Example: 'cluster=SN2&session=...'.
  • microsoftexcel_get_tableRetrieve details of a specific table in an Excel workbook stored in OneDrive, including its name, style, column count, and header/total row settings.Read-only

    Get Excel Table

    Retrieve details of a specific table in an Excel workbook stored in OneDrive, including its name, style, column count, and header/total row settings. Accepts either a numeric table ID or the table name.

    Inputs

    item_idstringrequired
    OneDrive item ID of the Excel (.xlsx) file. Example: '01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K'.
    table_idstringrequired
    Table name or numeric ID to retrieve. Example: 'Table1' or '1'. Both the table name and the workbook-assigned numeric ID are accepted.
    session_idstring
    Optional workbook session ID from createSession. When provided, sent as the workbook-session-id header. Example: 'cluster=SN2&session=...'.
  • microsoftexcel_get_used_rangeRetrieve the smallest range that contains any data or formatting on an Excel worksheet stored in OneDrive, without needing to already know the address.Read-only

    Get Worksheet Used Range

    Retrieve the smallest range that contains any data or formatting on an Excel worksheet stored in OneDrive, without needing to already know the address. Useful for reading all the data on a sheet in one call.

    Inputs

    item_idstringrequired
    OneDrive item ID of the Excel (.xlsx) file.
    worksheet_idstringrequired
    Worksheet name or GUID whose used range to retrieve.
    session_idstring
    Optional workbook session ID from createSession. When provided, sent as the workbook-session-id header.
  • microsoftexcel_get_worksheetRetrieve the properties of a specific worksheet in an Excel workbook stored in OneDrive.Read-only

    Get Excel Worksheet

    Retrieve the properties of a specific worksheet in an Excel workbook stored in OneDrive. Use the worksheet name or its GUID as the worksheet_id. Optionally accepts a workbook session ID.

    Inputs

    item_idstringrequired
    OneDrive item ID of the Excel (.xlsx) file. Example: '01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K'.
    worksheet_idstringrequired
    The worksheet name or GUID to retrieve. Use the sheet tab name (e.g., 'Sheet1') or the worksheet's unique GUID. Example: 'Sheet1' or '{00000000-0001-0000-0000-000000000000}'.
    session_idstring
    Optional workbook session ID from createSession. When provided, sent as the workbook-session-id header. Example: 'cluster=SN2&session=...'.

Workflows

Proxy API call
// Make a request via Scalekit proxy
const result = await actions.request({
connectionName: 'microsoftexcel',
identifier: 'user_123',
path: '/v1.0/me/drive/root/children',
method: 'GET',
});
console.log(result);
Execute a tool
const result = await actions.executeTool({
connector: 'microsoftexcel',
identifier: 'user_123',
toolName: 'microsoftexcel_list_worksheets',
toolInput: { item_id: '01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K' },
});
console.log(result);