How to open a txt file by excel with seperate column?

datatable
excel
activities

#1

Nice to meet you!
I am now trying to open a txt file by the activity “Excel application scope”.
My txt file looks like:

For%20question
When the file is opened by “Excel application scope”, all words in the same row are put into same one column like:
For%20question2

May I ask if there is any way to open it in Uipath by excel with seperate column (automatically seperate by space in row or else) like:
for%20question3

It’s my honor to hear your advice.
Thank you very much!


#2

@pengkai.hsu,
Can u try to open it Read csv. Replace the tab by semicolon .

Regards
Balamurugan


#3

Thank you for your advice!!

I tried it like this:


But it become like this:
advice2
It seems there is still space between number and JPY, and the word became strange:’(
Did I do anything wrong?

Thank you very much!


#4

Hi @pengkai.hsu, you need to enter appropriate encoding on your Read CSV, for Japanese I would suggest you “Shift-JIS”. Refer this also: https://activities.uipath.com/docs/supported-character-encoding.

And in your case, I think it would be easier to modify the text, like this:

  1. Read the text file as text (String)
  2. Replace all spaces with comma (seems like the separator is comma on your side)
  3. Add extra comma on the line before new line
  4. Write the String back as CSV

Attached a sample: Text to Excel.zip (1.8 KB)


#5

Thank you for your advice whyyouandi!!
I will try it soon after sunday!

Thank you very much!


#6

Hi!

I have tried using your code but i end up having this

but when i try to remove the additional coding you have (read/write) I end up getting this

What should i do to get them into nice columns?

Thanks!!

Avene


#7

Hello @avene,
I think you need to remove empty columns and remove the “-------------”! :smile: