How to add a record to a csv file
Q: I have a job which is processed through another bit of software, I get 1 file in and at the end of the process, I can have over 100 data files.
I need to add a record to the start of each file with the same structure, the fields can be empty but I do need to populate 2 of the fields.
- Sequence fields needs to be 000000
- Outname fields needs to be the name of the data file
I then need to add a record at the end of the file but only 1 field needs to be populated
- Sequence = 999999
Is this achievable in Limagito? I can do this within the software that processes the data but it will be a very long process to set up.
A: This should be possible using our scripting option.
- We used a Windows folder as Source:
- We added the following Include Filename filter because we want to be sure we only are going to handle csv files:
- As Destination we used our PScript (Pascal Script) option:
- Please add the following Pascal Script
- Please add the following script: link
- Do not forget to adjust the ctOutputPath ( path must end with a \ )
- This is the path where the adjusted csv files will be saved
- Example content of csv source file before changes:
- Example content of csv destination file after changes:
Feedback customer:
You are an absolute legend. Thank you very much
If you need any help with this “add a record to a csv file” question, please let us know.
Best Regards,
Limagito Team
#csv #managedfiletransfer #filetransfer #filemanagement