Saving .txt files in an unique Excel file


#1

Hello friends,
I would like to save all the files inserted in this zip folder
ricevute_del_2018-06-07-153046.zip (1.2 KB)
in a single Excel file with successive rows and separate columns.
Can you help me in excecuting this?
Thank you so much,
Camilla. :slight_smile:


#2

Hi CamiCat,

Just to understand more, each file has 2 lines of data, so overall you want your data in 10 rows in an excel and for columns what is the delimiter( separator ) is it β€œ;” if not what else ?

Thanks ,
Hari


#3

Hello @harinathreddy.yn,
the file doesn’t have a fixed number of lines.
The delimeter for the columns is the β€œ;”.
Thank you so much.
camilla.:blush::blush:


#4

What you will need to do is use .GetFiles() to store the text files in a list.
Then, use Append Text to combine them to one string.
Then, replace all commas with something else (if they have commas), and replace the β€œ;” with the β€œ,” comma so it will be a comma-delimitted text.
Then, finally you can just use Write Text File and use β€œ.CSV” as your extension, which will place the file into a table format (which you can use with Read CSV or whatever else.

For each file In System.IO.GetFiles("directory","*.txt")
    Append Text // using file

Assign text = text.Replace(",",".").Replace(";",",").Trim
Write Text File // using appended text with ".CSV" extension

Read CSV // if you want the data table. If not, then you are done

So I hope this helps.

Regards.


#5

@CamiCat BrowseAllFilesInDirectory.xaml (16.3 KB)

try above file it will work


#6

Thank you so much @Manjuts90.
I’ll try this workflow and let you know.
Thank you so much in advance.
Camilla
:slightly_smiling_face: