> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cassidyai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Analyze data with an Agent

> Ask an Agent to analyze spreadsheets, CSVs, and structured files to find insights, create charts, and answer questions.

Agents can analyze structured data like CSVs, spreadsheets, and tabular files. Instead of treating files as plain text, an Agent can write and run code to inspect the actual data, calculate results, create visualizations, and explain the findings in conversation.

This is powered by [Code Execution & File Creation](/agents/advanced/code-execution-file-creation), which is enabled by default for new custom Agents.

## Before you start

<Info>
  If data analysis is not available for an Agent, edit the Agent and make sure
  **Code Execution & File Creation** is enabled under **Customize** >
  **Advanced Settings**.
</Info>

## Provide data for analysis

You can provide data in several ways:

* **Upload a file in Chat** — Attach a CSV, Excel file, or other structured data file directly in the conversation.
* **Reference a Knowledge Base file** — If your data is already in the [Knowledge Base](/knowledge-base/overview), reference it in the conversation or in the Agent's instructions using **#**.
* **Use Connector results** — If your Agent has [Connectors](/agents/connectors/overview), Code Execution & File Creation can help the Agent work with large structured results from those tools.

## Analyze a file in Chat

<Steps>
  <Step title="Start a conversation">
    Open [Chat](/guides/chatting-with-an-agent) and choose the Agent you want to use.
  </Step>

  <Step title="Attach your data">
    Upload a spreadsheet, CSV, or other structured file.
  </Step>

  <Step title="Ask a specific question">
    Ask the Agent what you want to learn from the data. For example:

    *"Analyze this sales data and show monthly revenue trends, top-performing products, and any unusual changes."*
  </Step>

  <Step title="Review the results">
    The Agent writes and runs code behind the scenes, then returns the results in the conversation. It can include summaries, tables, charts, or downloadable files depending on your request.

    <Frame>
      <img src="https://mintcdn.com/cassidy/5YHx_-kdBDoXQv1s/images/agents/data-analysis-chat.png?fit=max&auto=format&n=5YHx_-kdBDoXQv1s&q=85&s=a387374b37326f95ff7219a07f061b7b" alt="Agent analyzing uploaded data and returning results in a conversation" width="2660" height="2570" data-path="images/agents/data-analysis-chat.png" />
    </Frame>
  </Step>
</Steps>

## Use Knowledge Base files

If you want the Agent to analyze the same file regularly, add the file to the Agent's instructions or reference a [Knowledge Base](/knowledge-base/overview) file in the conversation.

Knowledge Base files can also come from synced integrations like Google Drive, OneDrive, SharePoint, and Box, so the Agent can analyze the latest version.

<Frame>
  <img src="https://mintcdn.com/cassidy/5YHx_-kdBDoXQv1s/images/agents/data-analysis-instructions.png?fit=max&auto=format&n=5YHx_-kdBDoXQv1s&q=85&s=86ba0f020a809ee77f731fd332808c04" alt="Agent instructions referencing a specific data file from the Knowledge Base for analysis" width="968" height="1436" data-path="images/agents/data-analysis-instructions.png" />
</Frame>

## Tips for best results

<Tip>
  The more detail you provide, the fewer assumptions the Agent needs to make.
</Tip>

* **Use specific column names** — Reference columns by their actual names, such as "Location" or "Revenue."
* **Explain value formats** — Describe whether states are abbreviated, dates use a specific format, or currencies are mixed.
* **Provide context about the data source** — Explain where the data came from and what each table represents.
* **Use a powerful model** — Data analysis works best with high-powered, reasoning-capable models. See [Choose the right AI model](/guides/choose-ai-model).

## Related

<CardGroup cols={2}>
  <Card title="Code Execution & File Creation" icon="terminal" href="/agents/advanced/code-execution-file-creation">
    Learn how the Agent setting works and how to turn it on or off.
  </Card>

  <Card title="Create files in Cassidy" icon="file-export" href="/guides/create-files">
    Generate documents, spreadsheets, presentations, and reports.
  </Card>

  <Card title="Analyze data in Workflows" icon="diagram-project" href="/workflows/advanced/data-analysis">
    Analyze files and generate reports in repeatable Workflows.
  </Card>
</CardGroup>
