Assistance Required for Continuous Data Display in UiPath Form Without Reopening

Dear Team,

I’m currently working on a assignment where the objective is to iterate through each Excel file in a specific folder and display its data within a UiPath Form. Although I’ve successfully managed to display the data from the first file, I am encountering challenges with seamlessly loading subsequent Excel files into the same form.

My current approach closing and reopening the form to display the next set of data, which is not the desired behavior. When I tried using the “closeOnSubmit = false” property, it resulted in multiple forms being opened for each different sets of data, rather than updating the existing form.

Here’s a brief overview of the logic I’ve implemented so far:

  1. Using a ‘For Each’ loop to read data from each Excel file.
  2. Opening a form designer to display the data from the Excel file.
  3. In the ‘Form Do’ activity, I’ve set it to check if the ‘Submit’ button is clicked before proceeding to the next set of Excel data.

My goal is to ensure that the data from each Excel file is displayed in the same form without the need to close and reopen the form, or open multiple forms. I would greatly appreciate any guidance or suggestions on how to achieve this, ensuring a smoother user experience.

Thank you for your assistance.

Niraj Kumat
+91.931.343.5205

Hello @NirajkNir

DataTable allExcelData = new DataTable();

ForEach ExcelFile in ExcelFilesFolder
DataTable currentExcelData = ReadExcel(ExcelFile);
allExcelData.Merge(currentExcelData);

Open Form Designer
Bind controls to allExcelData
Form Do: If SubmitButtonClicked, Close Form
Open Form Once to display accumulated data

Thanks & Cheers!!!

Hi @Kartheek_Battu Thanks for the infor,
But i don’t want to close the form, “On click” of submit buttton form should load with the next Excel data insted of closing and reopening .

@NirajkNir

DataTable allExcelData = new DataTable();
int currentIndex = 0;

ForEach ExcelFile in ExcelFilesFolder

DataTable currentExcelData = ReadExcel(ExcelFile);
allExcelData.Merge(currentExcelData);

Open Form Designer
Bind controls to allExcelData

Form Do:

Display data based on the currentIndex
DisplayData(allExcelData.Rows[currentIndex]);

Check if 'Submit' button is clicked
If SubmitButtonClicked

    Increment index to load the next set of Excel data
    currentIndex++;

    Check if there is more data
    If currentIndex < allExcelData.Rows.Count
    
        Display the next set of data
        DisplayData(allExcelData.Rows[currentIndex]);
    
    Else
    
        Close form if all data is displayed
        Close Form

Hi @Kartheek_Battu ,
I was going through the process you explained about merging data from two Excel files, and I find myself needing a bit more clarity on a specific part of it.

My Excel data typically comprises varying numbers of rows – sometimes it’s 3 rows, other times 4, or more. Given this variability, I’m unsure how to identify the range of rows that pertains to the first set of data after merging it with the second Excel file.

Could you kindly provide a more detailed explanation on how to accurately determine this?

Apologies if this seems like a fundamental question, but I want to ensure I fully grasp the concept.

Thank you for your time and assistance!