Export data at the end of a flow as cvs file

I’ve implemented a flow that checks CSV data via import. Each checked row is written to a table with or without an error message. The table contents should then be automatically made available to the user as a CSV file.
What’s the best way to solve this task?

1 Answer

1

What is the trigger to the flow? How are you passing in the csv file?

The Directus API supports CSV output by adding on a ?export=csv to your API request. Your final csv URL will look something like this:

http://localhost:8055/items/posts?export=csv&filter[year(date_created)][_eq]=2025&filter[month(date_created)][_eq]=10&filter[day(date_created)][_eq]=15

Hi alexv! Thank you for your attention! The (import) trigger is event hook (items.create) to import the csv data. A data check is performed before import. If an error is found, the imported data is made available as a CSV file, including the errors. I collect the data (csv row, errors) in a table and want to create a csv file in the flow that is offered to the user for download. You mean I can call the URL from an operation and then get the csv file?

Ok, I see... The URL triggers the standard export as csv including table field names, quotation marks and the data I want :) Can I disable the field names and quotation marks?

The import is initiated manually, runs through the flow and receives as a response either the csv file including error text or an OK that the data has been imported.