Question
How do I delete records in a CSV file except for column names?
Answer
As an example, you can delete records excluding column names by configuring a script as follows.
- Read the file with Read CSV File operation.
Select [Do not get first row as value] in the Read settings tab. - Place Mapping and Write CSV File operations inside of Loop by Number of Data operation.
- Specify the same file in Write CSV File operation.
Select [Overwrite] and [Insert column names into first row] in the Write settings tab. -
Set a condition that does not match any records in If Loop logic in Mapper.
Connect each column as well as the condition.
Only the column name will be output to the file since no records should match the condition.
Note that the original file will be overwritten by the method above.
If you want to keep the data in the original file, try the following measures.
- Take a backup before processing and delete the backup after processing is successfully completed.
- Write the data to another file and replace it with the original file after processing is completed.
Read CSV File
https://www.hulft.com/help/en-us/HULFTSquare/Content/Designer/Connector/csv_get_data.htm
Loop by Number of Data
https://www.hulft.com/help/en-us/HULFTSquare/Content/Designer/Connector/flow_loop_by_number_of_data.htm
Write CSV File
https://www.hulft.com/help/en-us/HULFTSquare/Content/Designer/Connector/csv_put_data.htm
If Loop
https://www.hulft.com/help/en-us/HULFTSquare/Content/Designer/Mapper/IfLoop.htm
Comments
0 comments
Article is closed for comments.