How to use Multiple Excel under "Use Excel" so that "Template file" can be changing as the per input file selected from folder

I am using StudioX where i have multiple files placed in folder and i need read all of them one by one. How do i do that so that it can read all of them.


Use For Each File in Folder. Pass its currentitem to Use Excel File.

You need to use for each activity looping each file in the folder and make sure you check the file extension process only Excel file.

I tried to do that as below:



but getting below error:

Excel file on Use Excel File Scope must CurrentFile, not Selected_file. You’re looping in for each and your file’s name is CurrentFile.

And your source is wrong. It should be Excel.Sheet(“Your sheet name”)

@Vivek_Pandey2,

This is happening because you are giving File path instead of Sheet name at Source property of 1.3.1.1

Update it correctly like, Excel.Sheet and you should be good.

Thanks,
Ashok :slight_smile:

1 Like

@HaticeKubraYilmaz Sheet name is variable and it will keep on changing so can’t keep any sheet name and when i replaced that to Currentfile it was giving an error as below.



Can you write CurrentFile.FullName instead of CurrentFile? This will give you the full file path

Do sheet names change constantly or are there certain sheets for all Excel documents to be processed?

If so, you can use the switch activity to teach which sheets to read in which excel, because the activity must know which sheet to read

1 Like

You don’t put Selected_file into Use Excel File. You put CurrentFile (from the For Each) into the Use Excel File.

@HaticeKubraYilmaz Still encountering the same error as below

Also, the excel file keep on changing on weekly basis.

Isn’t Use Excel File Scope inside the for each file in folder activity? If not, you should do so because you are trying to loop the Excel files in the folder

MicrosoftTeams-image (3)

I understand that the Excel data changes, but does the sheet name also change?

Yes, Sheet name also keep on changing on weekly basis.

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