Split Text in textfile to Excel

We have data in textfile and we want to split with “|” and write it into excel file with proper data and we can not use build datatable because we have more than 300 columns.
test.txt (2.4 KB)

Did we try with Generate datatable activity with delimiter as pipe
@Gauri_Rawool

1 Like

Hi,

If you have your data as a file, you can directly read it to datatable using Read CSV activity as the following settings.
Then you can write the datatable to xlsx using Write Range Activity.

Regards,

yup but we dont have data in proper format in text file.

can u plz share a workflow.

Hi,

Can you change to “Pipe” at Delimiter property of READ CSV Activity?
It will work.

If there isn’t “Pipe” option , it might be needed to update UiPath Excel Activity Package

Regards,

Still not working. can you share your workflow.

Use Read Text File Save it in a Variable
Use Set To Clipboard and add this variable
Use Excel Application Scope
Then GoTo A1 by using goto function
Then use Ctrl+V
Then by using Record Macro do following steps and use this VBA code for invoke VBA
ALT+D+E
.
image
image
THEN next

Hi,

Hope this helps you.

Sample20200106.zip (11.0 KB)

Regards,

BUT IT IS NOT WORKING FOR THIS FILE.BAGI.txt (182.7 KB)

Hi,

BAGI.txt has 197 headers but has 198 data in each row.
So it causes exception in ReadCSV Activity.

If you cannot add a header or remove the last pipe in each lines, can you try the following sample for Generate DataTable Activity as workaround?

Sample20200107.zip (45.5 KB)

It won’t throw, but add new column header called “Column1”.

Regards,