# Make a file

> Turn text into a file, such as a CSV export, ready to send.

Source: https://docs.buildcord.dev/nodes/variables-and-data/make-a-file/

`data.makeFile` makes a file out of text the flow has, such as a CSV of a poll's votes, and keeps it as `{temp.file}`. Give that to a message's **Attach files** to send it, or to [Save a file](https://docs.buildcord.dev/nodes/variables-and-data/save-a-file) to keep it at an address that doesn't expire.

## Settings

| Setting | What it does |
| --- | --- |
| File name | Its name with its extension, such as `results-{option.poll}.csv`. The extension sets its type, so `.csv` opens in a spreadsheet and `.txt` as text. |
| Content | What the file holds. Tokens are filled in. |
| Save as | The name of the token it's kept in. `file` gives `{temp.file}`. |

## Produces

| Token | Value |
| --- | --- |
| `{temp.file}` | The file, for **Attach files** or Save a file. It isn't a web address, so it shows as gibberish in message text. |

## Limits

A file can be 8 MB at most, and Discord takes 10 files on a message.

## Example

A `/export` command finds every row of a `votes` collection for the poll with [Find rows](https://docs.buildcord.dev/nodes/variables-and-data/find-rows), set to find up to 500. A [Run code](https://docs.buildcord.dev/nodes/integrations/run-code) step turns them into lines:

```js
const lines = ctx.rows.all.map((row) => [row.user, row.choice, row.at].join(","));
return { csv: ["user,choice,at", ...lines].join("\n") };
```

Make a file named `votes.csv` with `{code.csv}` as its content, then reply with `{temp.file}` in **Attach files**.

## Related

- [Save a file](https://docs.buildcord.dev/nodes/variables-and-data/save-a-file)
- [Find rows](https://docs.buildcord.dev/nodes/variables-and-data/find-rows)
- [Reply](https://docs.buildcord.dev/nodes/messages/reply)
