Hello. I have problem with combining txt files into one.
When trying to use Add data row activity to append 22 txt files , the following error appears:
I suppose the cause is number of rows because in some other similar situations process works well, but with less rows.
Is there a way to expand number of rows that could be read and merged into one file?
Thatās cleaner than what I was thinking. I was thinking of appending to the file at the end of the loop for each file. What type is the variable ādestinationDataā? Just a string?
Yep, just a string. Text files are read into strings. By the way, note that my example assumes there are only the files you want to read, in that folder. Obviously you may need to adjust this logic to grab only the files you need.
You could use Append Line to append to the destination file each time, but I prefer to avoid unnecessary reads/writes. Concatenating everything into a variable and then writing it once is less resource intensive.
Seems like your csv files are not consistent. Different structure/number of columns causing the errors. You can only Add Row using an array if your table structure remains consistent otherwise it will be buggy.
Also, you could use Filter Datatable activity instead of looping and using a condition to add to another table.
initialize a datatable
Loop
read csv (into datatable)
merge to datatable from step 1 (Add keys if donāt exist)
Loop End