Create datatable from space seperated excel file

datatable
excel
uiautomation
activities
studio

#1

Hello Everyone,

Is it possible to create a datatable from a file which is separated by space as shown below

Please note there are 3 rows but all data is put into one column. Instead I want to have 3 rows and 11 columns in a datatable separated by Space delimiter

I can do this using “Text import wizard” in excel but how do I do it using Uipath? Should I still automate the excel steps (text import wizard steps) to convert it into this format?

I want to have a datatable out of this space separated data. Is it possible to generate datatable based on a delimiter?

Thanks
Selva


Excel is Empty but DataTable output is blank when queried for rows count
#2

@Selvasathappan

  1. using build datatable activity, create a datatable with 11 columns.
  2. First read the text from file and assign it to a string variable.
  3. Split the variable with respect to newline and u will get output as array.
  4. Use for loop, each time loop runs u will line by line text, Split that text with respect to space(i,e " "). u will get
    11 columns of data.
    5) using add datarow activity, u can add data to datatable.

Splitting data wrt to space and adding datarow will happen in every loop


#3

you can use read csv activity to read this file and convert it to data table. You can use space as delimiter. Only thing you might want to take care is about the spaces which you do not want to split. Because I see more than 11 columns if I split with spaces. You can try merging column contents and deleting columns after the read csv activity if required.