Manipulating Excel help required

excel

#1

Hello guys/girls,

To start with I would like to say that I am new with UIPath and I still haven’t figured it out how to correctly work with it. I watched tutorials but none show exactly what I need.
Well, let’s dig in…

I have to read “input.xls” file, get its data(it has no headers), then make new “output.xls” file WITH headers and then insert data to it based on header name.

For example: I read whole data from input.xls, then create new DataTable with headers like: name,lname, age. After that I shall take whole column(like column ‘A’) and insert it into output.xls files column that has age header. Hope I wrote everything clearly.
Or to make it easier - How to take column ‘A’ from input.xls and insert into column ‘H’ to output.xls and if it is possible to name that column “add header” before inserting.
Or maybe there is same topic already with solution and someone can provide link to it?

Thank you in forward for any help!


#2

Hi @pagalba,

Working on excel, you should define type of data that you use.
In this case no header, you can select data base on index of columns(ex: 0,1,2,3) in “For each row activity” then add new column

Regards


#3

Hi @pagalba,

Try this workflow, you may get some idea.

input.xls (18 KB)
output.xls (8.2 KB)
ExcelReadWrite.xaml (10.4 KB)


#4

@sarathi125
@Chinh_Le

Thank you both very much! I did not expect help that quick :slight_smile:


#5

@sarathi125

Hi, is there a way to PM you, I have some questions. :slight_smile:


#6

Please let me know


#7

@sarathi125 Hey, once again, sadly I don’t know how to PM ^^ So i’ll write here. I analized your given code, its going right direction although I was curious how to manipulate each column separately. I tried inserting data (in your given code) to specific column H, but it did insert all three columns (Name, Lname and age to H,G,I columns). What if i want to keep lname and age at column B and C but insert name to column H?
And one more question, what if input excel file has 3 columns, and on output excel file i need to make 6 columns name(column H), lname(column B) , age (column C) then giving header to column D but making it empty, and then giving headers to column E and F and adding random values to them? Is that even possible?
I could provide you my input, output files but kinda wanna make this “code” myself :smiley:
Thank you in forward!


#8

If we need to make more columns then we have to insert those in the output data table before writing it in the excel. by this way you can make where you want to insert the Column H data.