# Generate code to create Excel and CSV reports

### Why generate export code

Sometimes, you don't want to just download a snapshot of the current dataframe within Mito - you want to create code that takes one of these dataframes and saves it to a CSV or Excel file. This can be particularly useful if you're automating a full analysis within Mito.

### How to generate export code

1. Open the `Home` tab in the Mito toolbar.
2. Click the `Export` dropdown then select `Download File When Running Code`.
3. Change the `File Name` to the name of the file to save.&#x20;
4. Select the export format, either `CSV` or `Excel` files.
5. Select the dataframes you want to include in the export.&#x20;
   1. Note that if you select multiple dataframes when exporting as a CSV, Mito will automatically create distinct files for each.
6. Click the `Generate Export Code` button.&#x20;
   1. This saves the exported file to disk, and also generates code that will export a file with the same configuration as well.

<figure><img src="/files/9vOoyuCxy9mp9lEeLKZ6" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.trymito.io/how-to/exporting-to-csv-and-excel/generate-code-to-create-excel-and-csv-reports.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
