Use automation function blocks to create a CSV file.
There are a number of function blocks that allow the user to save real-time data or historical data to CSV files.