Skip to content
← All release notesNewanfra0.8.0

Download a query's whole result as CSV

`query.export()` makes a CSV of every row of a query's result, with the filters on screen applied, and downloads it for the reader.

Add a "Download CSV" button next to a table or chart:

if (Anfra.plugins.has('export')) {
  downloadButton.addEventListener('click', () => byRegion.export({ filename: 'Revenue by region' }))
}

The file holds every row, not only the pages the app has loaded, and runs with the same controls, cross-filter selection, sort and time zone as the result on screen. Values are written raw: numbers with every digit, dates in ISO 8601. formatOptions picks the header row (column labels, names or none) and the byte order mark that Excel needs for non-ASCII text.

From the terminal, anfra query export does the same for any query.

Full changelog (opens in a new tab)