Xano Documentation
Search…
πŸ’‘
Start here
☁️ Your Xano Account
πŸ’²
Special Discount Pricing
Generating CSV Files
Generate CSV Flat Files through the API
Generating CSV flat files can be done through the API in Xano.
​
Generating a CSV requires the use of headers and a filter in Xano.

Use the HTTP Header function to set two HTTP headers required to generate a CSV through the API.
Content-Disposition
Content-Disposition: attachment;filename="example.csv"
You can choose any file name you want, you don't have to use "example". The name can be made dynamic with sprintf as shown in the video above.
Content-Type
Content-Type: text/csv

The csv_create filter creates a CSV format data stream from a list of column names and their corresponding data rows.
Start with an array of the header names.
Then apply the csv_create filter. Add the array of values of the rows. It's recommended to leave the default values for the separator, enclosure, and escape.

A basic example of CSV Flat File generation.

When you run an API endpoint in this format, Xano will pick up that there is a downloadable CSV file and provide the option to download the file in the debugger:
Download a CSV file in the Debugger.
When you run this endpoint live, it will automatically start to download the generated CSV file. Give it a try in your browser.
Copy link
On this page
Downloading a CSV file