CSV Export

This function block facilitates the logging and export of data into a CSV file format. It allows users to specify the file path, file name, and conditions for starting the logging process and exporting the data.

📥 Inputs

Folder Path The directory where the CSV file will be saved.

File Name The name of the CSV file to be created.

Start Logging A boolean that, when set to true, begins logging the incoming data.

Export File A boolean that triggers the export of logged data to the specified CSV file.

Data_{i} Up to ten generic data inputs. Each can receive data that you want to log into the CSV file.

📤 Outputs

This function block does not produce any outputs.

🕹️ Controls

Set Data Headers Users can enter custom headers for each data input field to label them appropriately in the CSV file.

🎨 Features

Dynamic Logging Effectively logs data in real-time when the start logging condition is met.

Automatic Header Management Automatically creates or updates headers in the CSV file based on the user-defined headers.

Error Handling Comprehensive error messaging helps users troubleshoot issues related to file permissions or read/write operations.

📝 Usage Instructions

  1. Specify Folder and File Name: Connect the Folder Path and File Name inputs to determine where and how the CSV file will be saved.

  2. Configure Headers: Enter the desired headers for your data fields in the header text boxes.

  3. Start Logging: Send a true value to the Start Logging input to begin capturing data.

  4. Export Data: To export the logged data to CSV format, send a true value to the Export File input.

📊 Evaluation

When the conditions are met, this function block logs the incoming data along with the specified headers into the chosen CSV file. It handles the creation of a new file or updates an existing one, maintaining data integrity.

💡 Tips and Tricks

Setting Up File Paths

To avoid errors, it’s helpful to always check that the provided folder path exists prior to exporting. You can use folders that are readily accessible, like your desktop or a designated documents folder.

Managing Data Headers

Make sure to create meaningful headers that accurately describe the data being logged to make the CSV file more understandable and useful.

Frequent File Access

If you frequently access the CSV file, ensure that it is closed in any spreadsheet software before running the export function to prevent access issues.

🛠️ Troubleshooting

CSV File Not Exporting

If the CSV file doesn’t export, check for the following:

  • Permissions: Ensure that the directory is writable and that you have permission to create or modify files in that location.

  • Active Microsoft Excel files: If the file is currently open in Excel or any other program, close it before exporting.

No Data Logged to Export

If you receive a warning about no stored data to export, ensure that the Start Logging input has been activated and that there are actual inputs connected.

Last updated