Multiple excel files

Hi

I’ve bulk excel files. Now, I want to add one column and print the data.

How to get files from the folder and update the new column?

hello @ganesh_rajan

1)use read range activity to read the excel file
2) then add Data column activity to add column
3)then append range activity to add column in excel

hope it help

4 Likes

@ganesh_rajan

To read Excel files from folder:

strExcelFiles [ ] = Directory.GetFiles("Folder Path","*.xlsx")

It will give you output as string array. Then use For each loop to iterate files one by one and follow the steps mentioned by @sandeep13

3 Likes

Sure guys…will try it and let you know…thanks

One more question
For example: look like invoice

But now i want to take table only,Don’t want balance details.How to take table from mulitple excel sheet?and finally all tables combine into a single excel sheet.

hello
you use read range activity .you can specified range like “A1-10” of excel that contain table .

1 Like

Hi @ganesh_rajan

Buddy,…

  1. Use a assign activity wth left side variable out_files of type string array and right side like
    Directory.GetFiles(“Your path”,"*.xlsx")
  2. Use a for each loop to iterate through this string_array and mention the type of for each loop as string in type argument
    Here is your solution buddy
  3. Use excel application scope, Once you open a excel application scope you will have a property workbook which gives us the workbook type value, get it with a variable name out_workbook of type workbookapplication
  4. Use a assign activity with left side of string array type variable named out_sheets and right side like
    out_sheets = Out_workbook.Getsheets.ToList()
  5. use for each loop to iterate the sheets with this out_sheets as input and mention the item
    from for each loop to iterate the out_sheets
  6. Then you can use write range to enter the datatable
    4.Thats all buddy you are all done

Cheers

Cheers


image

Actually i’m trying to add one more column like exno,sno,name,address

How to do that?

Buddy @ganesh_rajan

You can do like this buddy

  1. read range with out variable of datatable type - named out_dt
    2.invoke method with object as out_dt.Columns.Add
    and method as SetOrdinal with which you can add the column anywhere by menitioning the parameter the index where the column to be added

Hope this would help you
Cheers

1 Like

that’s great.let me try

1 Like


its showing "exno"on runtime only.after that i’m not able to see in excel file in this columns.

Buddy usually append range adds to the existing range in excel where your existing range doesn;t have this column buddy

Better we can create a new sheet2 instead of sheet1 and try to use write range buddy this will work buddy

Cheers

can you send .xaml file for this?

yah sure buddy @ganesh_rajan,

Here is your xaml
adddatacolumn.xaml (7.7 KB)

Hope this would help you
Cheers

Thanks buddy

1 Like

@ganesh_rajan
Kindly let know if it works or not buddy…else we can tweak a bit more on it

Cheers buddy

It’s not working actually.i tried different way.now working good… using build datatable.created successfully.

2 Likes

Are you in linkedin?..we can talk to there.

Thats amazing buddy. Kindly close this thread with right comment marked solution that could help others looking for idea under your topic

Cheers…Buddy @ganesh_rajan

Keep going

Yes i m there in same name buddy