Adding new row to excel from multiple xlsx/csv

Hi Everyone,

I tried to have one single excel file consisting data from other excel (since the excel has data from every single month)

so what i want to do is, extracting data (only need column 2 and 3) from every other table and append it to a single excel files. how to do it?

any help is very much appreciated,

Thank you

Hi @Vi_ciel !
Do you have dummy data so we could look for it together ?

  • Among all the excel files, do you have a primary key ? (a sort of column that has ID, or several columns that act as an ID).
  • do you need to add columns everytime you read an excel file, or do you need to add rows (avoiding or not duplicates ? based on a primary key/ID ?)

Dear @Vi_ciel

You can keep all the excel files in same folder, and try to read the folder from UiPath

for loop (Directory.GetFiles(“full path”)){
//use read range (fileName) - specify the cell numbers (for the last row you can do total datable rowcounts - 1
//append range
//clear datatable

Regards,
Goutham
//

Hi Hiba,
Thank you for replying, my objective is basically appending new row everytime there’s a new data (which is every month)
i send two excel file for example, i want the “B” file to be appended to the “A” files, and since there will be new report for every two months, i want it to be appended as well next time i have a new report (for example “c” files) to the same “A” files.

i dont need to add the rows, because the format is actually the same, so it should always have the same number of rows. it will be good to have additional protection against duplicates tho, so the next time i reiterate the automation, the same “B” files dont get duplicated again…

Please show me the way, thank you so much

A.xlsx (8.3 KB)
B.xlsx (8.4 KB)

Hi @Vi_ciel !
Here is a suggestion: Append_columns_check_duplicates.xaml (15.8 KB)
Don’t forget to create your folder that will contain files B, C, D etc, and change paths in the initialization sequence) :wink:

Let us know if it does not work as expected !

1 Like

Hi @Hiba_B ,

Thank you very much for your work +.+ i cant be more thankfull +.+
i am just confused, when i try to do start it, it seems good until it goes to “Copy from B to A data” it always give error “no row in position 7”?
can you give me pointer on how to resolve it? Thanks for the help

That’s very strange. This type of error comes as if there are more rows in A file than in B. Do you confirm that there are the same number of rows in both files ?
Also, did you try with the file you sent us or directly with a much bigger volume of data ?

1 Like

My Mistake, apparently it needs to be the same number of row thank you very much, hope you have a very very good day ^^

Great that it works!!
Happy automation :grin:

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