Insert Column for files from each folder

Hi Team,

Please can anyone help me to provide logic for inserting a column to an excel from each folder. As its dynamic. It’s getting very tough for me to create the flow.

Thanks
Vanitha G

Hi

On a high level

  1. Get the array of file path from the folder with Directory.GetDirectories(”your main folder path”,“*.xlsx”,SearchOption.AllDirectories) which will give all the files from a folder and it’s sub folder as a array of string

  2. Now use a FOR EACH loop and pass the above array as input and change the type argument as string

  3. Then inside the loop use a Insert column activity
    https://docs.uipath.com/activities/other/latest/productivity/excel-insert-column

This will insert the column u want in all excel files

Hope this helps

Cheers @vanitha.govindan

Hello @vanitha.govindan

  1. Get List of Folders
  2. For Each folder in FoldersList
    3. Excel Application Scope
    • Open Excel File in folder
    1. Insert Column
      • Add column to Excel file
    2. Save Excel File
    3. Close Excel Application Scope
  3. End For Each

Thanks & Cheers!!!

Hi @vanitha.govindan

you can try this xaml

Xaml:- Insert Column for files from each folder.zip (1.9 KB)

it will insert the columns if the files are dynamical also

Directory.GetFiles(“YourPath”,“*.xlsx”) = you can keep the your filepath

image

let me know its working or not for you…!