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
1
Content-Type: text/csv
Copied!
Filter: csv_create
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.
Basic example of a function stack creating a CSV:
A basic example of CSV Flat File generation.
Downloading a CSV file
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.