Read multiple excel files

if there are multiple excel files in folder and I want to read all excel files without forloop then how i do it

file folder path is the folder where all excel files then i want to read all excel files.

Hi @yogitagaikwad2206
Try this

I hope it will helps!!

I hope this will help you,

excelFiles = Directory.GetFiles(folderPath, “*.xlsx”)

  1. This will retrieve all files with the extension “.xlsx” in the specified folder. If you have different file extensions, adjust the pattern accordingly (e.g., “*.xls” for older Excel files).
  2. Add an “Invoke Method” activity to the workflow.
  3. In the “Invoke Method” activity, set the following properties:
  • TargetObject: Create a new variable of type System.Collections.Generic.List<System.Data.DataTable>. Let’s name this variable “excelDataTables”.
  • TargetType: Set it to System.Collections.Generic.List<System.Data.DataTable>.
  • MethodName: Set it to “AddRange”.
  • Parameters: Click on the “Add” button to add a new parameter.
    • Name: Set it to “collection”.
    • Type: Set it to System.Collections.Generic.IEnumerable<System.Data.DataTable>.
    • Value: Set it to excelFiles.Select(Function(file) New System.Data.DataTable().ReadRange(file)).
  1. Now, you need to install the “UiPath.Excel.Activities” package if you haven’t already. This package contains the “Read Range” activity used in the “Value” parameter of the “Invoke Method” activity.
  2. Run the workflow, and it will read all the Excel files in the folder and store their data in the “excelDataTables” variable, which will be a list of data tables.

By using the “Invoke Method” activity with the “AddRange” method and the “Read Range” activity, you can read all Excel files without explicitly using a for loop in UiPath Studio.

Thank you

can u send workflow of read all csv files from one folder without for loop and print file names