Convert TXT file to XLSX with no delimiter

Hi, I’m now work with txt file that I have to xlsx file. The txt file it self cannot converted using generate data table because its not have a delimiter to define a column, I have to substring each row from spesific index to get a column data. Is there a more efficient way other than split new line than loop and substring each row? I attach an example of the file also, I have to get index 4-8 for Column 1, and index 45-54 for Column 2

Example.txt (2.0 KB)
Thank you and have a nice day!

@Hendaryie_Tjoeng

Please try below steps

  1. Read the data into string variable using read text
  2. As you know the length…use fixed length format option in generate datatable and convert the string to datatable
  3. Delete the columns that are not needed using remove data column
  4. Write range datatable to excel

Hope this helps

Cheers

Thank you for reply, can you show me example about this step “As you know the length…use fixed length format option in generate datatable and convert the string to datatable” ? Thank you

@Hendaryie_Tjoeng

This is how you can set the length of eqch column if there are no delimiters…just count the number of characters for each column and provide value with comma separation

Hope this helps

This is a sample xaml

https://forum.uipath.com/uploads/short-url/cyHdkbaBiSgZfa75ibJTG12eo25.zip

Cheers

Thank you very much, it’s work and more fast than loop 1 by 1

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.