Hello, I am wondering how to solve this kind of task in the best possible way. I have 10 .txt files with the same headers but different data below (see screenshot examples).
I would like to read those 10 txt files into one datatable, which should look like this (I only inserted two file examples) :
If someone could share ideas on how to solve this kind of task, I would really appreciate this. Thank you guys for your time!
Use Build Datatable Activity and define the Columns, and Get the Output as resultDT
Get the full Paths of the txt files present in a Folder by using this Expression:
txtFiles = Directory.GetDirectory(“yurFolderPath”,“*.txt”)
Where txtFiles is an array of String type Variable.
Use For Each of txtFiles and change the Type Argument to String
Inside For Each Do these
Use Read Text File Activity and pass the variable item to it as the File name
Get the Output of Read Text File, say tableData
Use Generate Datatable Activity, with input as tableData, Click on CSV Parsing and
Check First Row as Column Headers.
Get the Output From Generate Datatable Activity as tempDT.
Use Merge Datatable Activity, with Destination as resultDT and Source as tempDT.
Outside the For Each Loop, Use Write Range Activity and use the resultDT as the Datatable.