Append CSV
Appends a data table to the end of a CSV file.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
if ContinueOnError property is true, no error is caught when the project is executed even if Catch node is used.
Input
- File Path - Path to the CSV file to which the table will be appended.
- Table - Table to be appended to the CSV file.
Options
-
Separator - Separator character used in the CSV file. Default value is comma.
-
Append with Encoding - Encoding with which the CSV file will be appended. Default value is utf8.
Values:
- UTF-8
- UTF-16
- Windows 1250
- Windows 1251
- Windows 1252
- Windows 1253
- Windows 1254
- Windows 1255
- Windows 1256
- Windows 1257
- Windows 1258
- ISO 8859-1
- ISO 8859-2
- ISO 8859-3
- ISO 8859-4
- ISO 8859-5
- ISO 8859-6
- ISO 8859-7
- ISO 8859-8
- ISO 8859-9
- ISO 8859-10
- ISO 8859-13
- ISO 8859-14
- ISO 8859-15
- ISO 8859-16
- Macintosh
- KOI8-R
Note:
- The CSV file must exist before appending the table.
- The Table input must be in a data table compatible format.
- Encoding and Separator options depend on the configuration of the original CSV file with which we are going to append to.
How It Works
The Append CSV node performs the following steps:
- Validates File Existence - Checks if the specified CSV file exists at the given file path
- Reads File Encoding - Opens the file using the specified encoding format to ensure proper character handling
- Parses Data Table - Converts the input data table into CSV-formatted rows
- Appends Data - Adds the new rows to the end of the existing CSV file using the specified separator
- Preserves Format - Maintains the original file structure and encoding while adding new data
- Closes File - Safely closes the file stream after the append operation
Requirements
- File System Access - Write permissions to the target CSV file location
- Valid CSV File - The target file must exist and be a valid CSV file
- Data Table Format - Input data must be in Robomotion data table format
- Encoding Match - The append encoding should match the original file encoding to prevent data corruption
- Disk Space - Sufficient disk space to accommodate the additional data
Error Handling
| Error Code | Description | Solution |
|---|---|---|
| FILE_NOT_FOUND | The specified CSV file does not exist | Verify the file path and ensure the file exists before appending |
| PERMISSION_DENIED | Insufficient permissions to write to the file | Check file permissions and ensure the automation has write access |
| INVALID_TABLE_FORMAT | The input table is not in valid data table format | Verify the table structure matches data table requirements |
| ENCODING_ERROR | Encoding mismatch or invalid encoding specified | Ensure the encoding matches the original file's encoding |
| DISK_FULL | Insufficient disk space to complete the operation | Free up disk space before retrying |
| FILE_IN_USE | The CSV file is locked by another process | Close the file in other applications before appending |
Usage Examples
Example 1: Append Daily Sales Data
Append new sales records to an existing sales report CSV file:
Input:
- File Path: "C:\Reports\monthly_sales.csv"
- Table: salesData (contains today's transactions)
- Separator: Comma (,)
- Append with Encoding: UTF-8
Result: Today's sales data is added to the end of monthly_sales.csv
Example 2: Append Log Entries
Add new log entries to a system log file with custom separator:
Input:
- File Path: "/var/logs/system_events.csv"
- Table: logEntries (contains error logs)
- Separator: Semicolon (;)
- Append with Encoding: UTF-8
Result: New log entries are appended while maintaining semicolon separation
Example 3: Append International Data
Append data with special characters using appropriate encoding:
Input:
- File Path: "D:\Data\customer_feedback.csv"
- Table: feedbackData (contains non-ASCII characters)
- Separator: Comma (,)
- Append with Encoding: UTF-16
Result: Customer feedback with special characters is properly appended
Usage Notes
- File Must Exist - Unlike Write CSV, Append CSV requires the target file to already exist. Use Write CSV to create new files.
- Header Handling - Headers from the data table are not appended. Only data rows are added to maintain consistency with existing structure.
- Concurrent Access - Avoid appending to files that are open in other applications (Excel, text editors) to prevent file locking issues.
- Large Files - When appending to very large CSV files (over 100MB), consider performance implications and available memory.
- Encoding Consistency - Always use the same encoding as the original file to prevent character corruption.
- Separator Match - Ensure the separator matches the original file's separator for proper data structure.
Tips
- Verify Before Append - Use a Read CSV node first to verify the file exists and has the expected structure.
- Error Handling - Always use Try-Catch blocks when appending to handle file access errors gracefully.
- Backup Strategy - Consider creating backups of important CSV files before appending large amounts of data.
- Batch Operations - When appending multiple small tables, consider combining them first to reduce file I/O operations.
- File Validation - After appending, read a few rows to verify the data was appended correctly.
- Use Absolute Paths - Always use absolute file paths rather than relative paths to avoid ambiguity.
Related Nodes
- Write CSV - Create a new CSV file or overwrite an existing one
- Read CSV - Read data from a CSV file into a data table
- Split CSV - Split a large CSV file into smaller files
- Data Table - Learn about data table format and operations