How to save an .xlsx file as a .txt file in UiPath

I have an Excel file that contains merged cells. I want to convert the .xlsx file to a .txt file with a tab-delimited format. When I try to do it manually, it works as expected. How can I achieve this in UiPath?

This is the step when i do manually:

  1. Open Excel
  2. Save as .txt

Here are the result of txt file

Hi @Vhierdy_Hafidz

Can you try like below using Output Data Table as Text activity

Regards,

1 Like

Use Write CSV activity, provide tab as delimited format
and provide csv path with .txt extension.

Hello @Vhierdy_Hafidz ,

you can use this activity Write CSV as shown below and it has property of delimited format

Regards,
Dheerandra Vishwakarma

Hey @Vhierdy_Hafidz can you try it with

or else you can use this linq query as wellvariable type is of String pass this linq query using Assign activity

String.Join(Environment.NewLine, dt1.AsEnumerable().Select(Function(row) String.Join(“,”, row.ItemArray.Select(Function(item) item.ToString()))).ToArray())

cheers

Use “Excel Application Scope” to open the Excel file.
Use “Save Workbook As” Activity
Set File Format to "Tab Delimited (.txt)".
Close the Excel file(automatically done by UiPath).

Thank you for your response. However, the result is not as I expected.
Empty cells in Excel should remain as spaces/tabs, not disappear like in the text output.

result:

Thank you for your response. why the spaces / tabs not included in txt result?
it’s not expected as i do it manually

  1. Excel

  2. Csv

  3. Result .txt

Hi sir, i cannot find Save Workbook As activity.

i only can find, Save Excel File As. but there’s no .txt and format delimeter

Hi sir, i did use Write CSV. but it didnt expected as i do it manually.
is there any problem with my activity, would you share your result if you run your workflow with that sir?

Hi sir, i did use Write CSV. but it didnt expected as i do it manually.
is there any problem with my activity, would you share your result if you run your workflow with that sir?

Regards

After many attempts, I finally found the solution:

  1. Excel Process Scope → Use Excel → Read Range
  2. Write CSV → Delimiter: Tab

When I use modern activities, the result is as expected compared to using classic activities.

Thank you all for your responses! :blush:

1 Like

Hey @Vhierdy_Hafidz have you select the Tab option from the Csv Activity Property Section.

cheers

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