How to Convert Excel Columns to Text Format using UiPath

Can you help me to convert a Excel Column into Text format using UiPath?

Please note that the number of rows in that particular column is dynamic.


1 Like


Welcome to the UIpath Community.

  1. use Read Range Activity to read data from Excel and will give you output as dataTable and say ‘DT’.
  2. Then use For Each Row Activity to iterate that DataTable.
    ForEach row in DT

The above one print all rows values in that coloumn.

1 Like


This will convert the column to String format i.e. it will be ‘General’
in Excel

I want the column to be ‘text’ format in excel.

Hi @apoorrv09

Welcome to UiPath community

you can write a Macro for that and run with INVOKE VBA activity in uipath
Record a macro and save it in a text file
mention the macro name in properties
and keep the activity invoke vba inside a excel application scope activity (pass the file path as input to excel application scope)

Try this and let know
Cheers @apoorrv09

The macro can be something like the following:

Range cells = xlWorkBook.Worksheets[1].Cells;
        // set each cell's format to Text
        cells.NumberFormat = "@";

Then paste in your data. I can put together a UiPath example for you.

1 Like

Here is an example which cycles through all sheets and updates a given range to Text Format

You can then simply paste in your data via an excel activity in UiPath or pass the data to the code and input it that way, which would be somewhat cleaner.

FormatCells.xaml (6.5 KB)

1 Like

An simple activity to change the format of the column. Take a look in the below link.