# OneDrive Integration

For AV firms running on Microsoft 365, point AVCodex at the OneDrive that holds your project files. The agent reads, searches, uploads, and edits Excel BOMs in place.

---

Connect Microsoft OneDrive to your AVCodex agent so it can search, browse, read, and upload files in the connected user's personal OneDrive storage, and edit Excel spreadsheets at the cell level.

## What the AI Can Do

Once connected, your agent gains ten tools:

| Tool | Description |
|------|-------------|
| **onedrive_search_files** | Search for files by name or content |
| **onedrive_list_files** | List files and folders in a directory |
| **onedrive_read_file** | Read the contents of a file |
| **onedrive_get_metadata** | Get detailed file or folder metadata |
| **onedrive_upload_file** | Upload a text file to a specified path |
| **onedrive_excel_get_worksheets** | List worksheets (tabs) in an Excel file |
| **onedrive_excel_read_range** | Read a specific cell range (e.g. `A1:D10`) |
| **onedrive_excel_write_range** | Write values to a specific cell range, in place |
| **onedrive_excel_append_row** | Append a row to the bottom of a worksheet |
| **onedrive_excel_get_used_range** | Read all populated data in a worksheet |

### Supported File Types

- **PDFs, Word (.docx), Excel (.xlsx), PowerPoint (.pptx)**: extracted via document parsing (manufacturer spec sheets, AS-built drawings, BOMs)
- **Text files** (JSON, CSV, XML, Markdown, JavaScript, code): read directly (Crestron SIMPL# source, Q-SYS Lua modules)
- **Binary files** are identified but cannot be displayed as text

## Connecting OneDrive

  **1.**
    **Open the Integrations tab**

    In your agent's builder, navigate to the **Build** section and select the **Integrations** tab. Find **Microsoft OneDrive** in the list of available integrations.

  **2.**
    **Click Connect**

    Click the **Connect** button next to OneDrive. A Microsoft OAuth popup will appear.

  **3.**
    **Authorize access**

    Sign in with your Microsoft account and grant the requested permissions. The integration requests file read/write access and site read access.

  **4.**
    **Test it out**

    Once connected, open the chat preview and try:
    - "Search my OneDrive for the Acme Corp HQ project proposal"
    - "List the files in my Project Docs folder"
    - "Read the contents of the BOM spreadsheet"

## Folder Restrictions

You can optionally restrict the integration to specific folders. When configured:

- **List** shows only the allowed folders at the root level
- **Search** results are filtered to files within the allowed folders
- Files outside the configured folders are not accessible

Useful for keeping the agent scoped to engineering's project directory and out of HR or finance folders.

## How It Works

The integration uses the Microsoft Graph API to interact with OneDrive. Files can be referenced by either their item ID or their file path (e.g., `/Projects/Acme-HQ/AS-Built.docx`).

When the agent reads a file:
1. It checks the file's MIME type and size
2. For document formats (PDF, DOCX, XLSX, PPTX), it uses document parsing to extract text
3. For text-based formats, it reads the content directly
4. Binary files are identified with their type but cannot be displayed

## Editing Excel Files

The Excel workbook tools let the agent edit spreadsheets **in place** without replacing the whole file. Powered by the Microsoft Graph workbook API and reuses the same OAuth connection. No separate Azure AD setup needed.

Typical workflow:

1. **Discover structure**: "List the worksheets in my BOM on OneDrive"
2. **Read existing data**: "Show me cells A1:D20 of the Room Equipment sheet"
3. **Write or append**: "Set cell B5 to QSC NV-32-H" or "Append a new row with today's truck-roll log"

Example prompts:

- "Add a row to my truck-roll log: today, Acme HQ Boardroom 4, 'replaced bad HDBaseT extender'"
- "Read the data in `/Projects/Acme-HQ/BOM.xlsx` and tell me which line items are still pending"
- "Update cell C3 of the Commissioning sheet to 'Signed off'"

The agent automatically figures out worksheet names, used ranges, and column letters.

## Example Use Cases

- **Doc retrieval**: "Find and read the latest commissioning checklist for Acme HQ"
- **File browsing**: "What files are in the Acme HQ project folder?"
- **Doc creation**: "Create an AS-built summary from our commissioning notes and upload it to OneDrive"
- **File search**: "Search for any files related to the Q1 dealer-program rollout"
- **BOM updates**: "Append today's installed-equipment list to the BOM tracker"

## Billing

OneDrive tool calls use your standard LLM token billing. There is no separate per-call fee.

*AVCodex · Your AV expertise. Amplified by AI.*
