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

# Using Langdock for Data Analysis

> Analyze tabular files, calculate metrics, create charts, and generate data files in Langdock.

Analyze CSV files, Excel sheets, and Google Sheets directly in chat. Langdock can inspect rows and columns, calculate metrics, create charts, and generate new files from your data.

For spreadsheet preview details in the Library, see [Recent Files](/en/using-langdock/library/recent-files).

## What you can do

Use Langdock for data analysis when you want to:

* Read tabular data from CSV, Excel, and Google Sheets files
* Calculate metrics, correlations, distributions, and deviations
* Compare segments, columns, regions, time periods, or categories
* Create charts and visualizations from data
* Generate files such as Excel, CSV, Word, PDF, JSON, and text files

## Analyze a spreadsheet

<Steps>
  <Step title="Add your data">
    Upload a CSV or Excel file, connect a Google Sheet, or select a spreadsheet from your integrations.

    <Frame>
      <img src="https://mintcdn.com/langdock-34/n3Mlc6DLTZAKfh4q/images/data-analyst-1.png?fit=max&auto=format&n=n3Mlc6DLTZAKfh4q&q=85&s=7928055fecc9a19c2f49b49c3c097daa" alt="Example spreadsheet uploaded in Langdock" style={{borderRadius: '6px'}} width="2998" height="2086" data-path="images/data-analyst-1.png" />
    </Frame>

    <Tip>
      Keep column titles in the first row for better results.
    </Tip>
  </Step>

  <Step title="Ask a specific question">
    Describe the metric, grouping, time period, and output format you need. For example, ask Langdock to summarize trends, calculate totals, compare columns, or create a chart.
  </Step>

  <Step title="Review the result">
    Check whether the answer uses the right columns, filters, and assumptions. If anything is missing, ask a follow up question with the exact correction.

    <Frame>
      <img src="https://mintcdn.com/langdock-34/n3Mlc6DLTZAKfh4q/images/data-analyst-3.png?fit=max&auto=format&n=n3Mlc6DLTZAKfh4q&q=85&s=dede170f0ac7ea55b008106eca91565d" alt="Data analysis result in a Langdock chat" style={{borderRadius: '6px'}} width="3348" height="2124" data-path="images/data-analyst-3.png" />
    </Frame>
  </Step>

  <Step title="Generate an output file">
    Ask Langdock to export the result as a spreadsheet, document, PDF, JSON file, or chart image.
  </Step>
</Steps>

## Example prompts

Use specific prompts that name the data, calculation, and expected output:

* "Analyze monthly sales trends over the last 12 months and identify seasonal patterns"
* "Calculate the average deal size by region and return the result as a table"
* "Find the top 5 products by revenue and create a bar chart"
* "Compare churn rate by customer segment and explain the largest differences"
* "Create an Excel file with one sheet per region"

## Statistical analysis examples

Langdock can help with common statistical tasks on tabular data:

| Task               | Example request                                                            |
| ------------------ | -------------------------------------------------------------------------- |
| Correlation        | "Calculate the correlation between ad spend and revenue"                   |
| Distribution       | "Show the distribution of order values and identify outliers"              |
| Deviation          | "Find rows where actual spend differs from budget by more than 10 percent" |
| Segment comparison | "Compare average revenue by customer segment"                              |
| Trend analysis     | "Show month over month growth for the last year"                           |
| Histogram          | "Create a histogram of customer ages with 20 bins"                         |
| Scatter plot       | "Create a scatter plot of discount percentage and order value"             |
| Heatmap            | "Show a heatmap of the correlation matrix"                                 |

## Output formats

Langdock can return analysis results in several formats:

| Output         | Use when                                                         |
| -------------- | ---------------------------------------------------------------- |
| Text           | You need a summary, explanation, or recommendation               |
| Table          | You need structured results in the chat                          |
| Chart          | You need a visual comparison, trend, or distribution             |
| Generated file | You need a downloadable spreadsheet, report, JSON file, or image |

In the [Excel plugin](/en/using-langdock/microsoft-plugins/excel), replies cite workbook cells as clickable pills that open the referenced sheet and select the range, so you can check every result against the underlying data.

## Data analysis vs document search

Use data analysis for structured rows and columns. It works best for calculations, comparisons, transformations, charts, and generated spreadsheet files.

Use [document search](/en/using-langdock/chat/tools/document-search) for prose documents, contracts, reports, and files where you need text extraction or source based answers.

<Info>
  In Agents, add **Create & work with files** under **Actions > Capabilities** when this capability is available in your workspace.
</Info>

## Best practices

* Use descriptive column names. Refer to the full column title instead of labels like "Column K".
* Keep column titles in the first row whenever possible.
* Avoid empty cells when you can.
* Include the metric, grouping, time period, and preferred output format in your prompt.
* Break complex analysis into multiple prompts when the first result is incomplete or incorrect.
