How to loop through Excel rows

How to loop through Excel rows

Overview

This guide will demonstrate how to process data for each row in an Excel file within your RPA workflow. We'll achieve this by creating two workflows: a main workflow to read the Excel data and a sub-workflow to process each individual row.

Common use cases:

Data migration: Transferring data from Excel to other systems like CRMs, ERPs, or databases
Data transformation: Manipulating data within Excel, such as formatting, calculations, or filtering
Web form automation: Automating the filling in of web forms with data from each Excel row
API Interactions: Sending data from each Excel row to an API endpoint

Building the main workflow

1. Create a new flow
    1. Go to the My Flows page and click Create flow.
    2. Give your flow a name and a description, and then choose the folder where you want to store the workflow.
    3. Then, select the required RPA agent to run the workflow. RPA agents are desktop machines that execute the workflow. The flow will run on the selected agent.
      1. You can change the agent later in the workflow builder, but ensure that file paths and other configurations are compatible with the new agent.

2. Set the trigger
The first step in building a workflow is to select a trigger. A trigger is an event that initiates the workflow. For this example, we’ll use the File or Folder event trigger and set the trigger event as Created, so the RPA bot will monitor a specific folder, and every time a new file is added to the folder, the workflow will get triggered.


3. Open and read the Excel file
    1. Use the Open Excel task to specify the file path. You can use a dynamic file path (obtained from the trigger output), so this will be the file path for the new file that is added every time to the specific folder.
      1. You can also use a static file path in case you want the RPA bot to read from a specific predefined file path.
       
    1. Use the Read from Excel task to extract data from the desired sheet. Configure the sheet name, header row, and data format as needed. Here, we read all the data from the required sheet. Select Read data from > Entire sheet and configure the header row accordingly.
    2. Since we're using a dynamic file path from the trigger, we cannot directly fetch the sheet names from the file. Therefore, you'll need to manually specify the sheet name in the Custom Value for Sheet name field.
Note: If you plan to further process the extracted data in other cloud app actions, such as integrating with Slack or Zoho CRM or Custom Functions, select Yes for the Use the output data in subsequent cloud app actions? option. This will transfer the data from the Excel file to the RPA server, where it can be manipulated and used by other cloud app actions or custom functions. 

However, if your processing needs are limited to local operations, like copying data within Excel files or transferring data between Excel and an ERP system, you can select No. This will keep the data processing within your local environment, avoiding unnecessary data transfer to the RPA server.
  1. We'll be using this output data in a custom function in the next step. Please select Yes for Use the output data in subsequent cloud app actions?
4. Create a custom function
  1. Go to the LOGIC tab and click + Custom Function and then click Create custom function.
  2. Name the function, for example, "processExcelRow".
  3. Add an input parameter of the "String" type to receive the Excel data we read from the sheet. Example: "excel_data".



    Here's the code snippet for the custom function:
    1. void processExcelRow(string excelData)
      {
      data_list = input.excelData.toJSONList();  //convert the input string to a JSON list to iterate over each row.
      for each row_data in data_list
      {
      final_map = map();  // For each row, create a map to store the data.

      // Ensure the column names in row_data.get("Employee Name") match the column headers in your Excel sheet.
      final_map.put("Name", row_data.get("Employee Name"));  
      final_map.put("Email", row_data.get("Email Address"));
      final_map.put("Department", row_data.get("Department"));

      //Use the "Invoke URL" task to call the sub-workflow, passing the data map as a parameter.
      call_flow2 = invokeurl
      [
          url: "Replace sub workflow webhook trigger URL here"
          type: POST
          parameters: final_map
          
      ]; } }

  4. Now save the custom function. Return to the workflow builder screen and add this custom function to the main workflow. Configure the function's input with the data extracted from the Excel sheet.



Building the sub-workflow

1. Create a new flow
  1. Navigate to the My Flows page and click Create Flow.
  2. Give your sub-workflow a name, such as "Process Excel Row Data", and then choose the folder where you want to store the workflow.
  3. Finally, select the required RPA agent to run the workflow.
2. Set the trigger
  1. Choose the Webhook trigger as the trigger for this workflow. Copy the webhook URL using the copy button.


  2. Now, switch to the main workflow and locate the custom function you created for processing each Excel row.
  3. Within the invokeUrl task of the custom function, you'll find a placeholder URL. Replace it with the actual webhook URL you copied from the sub-workflow configuration in the previous step and save the function.


  4. Click the Test button within the sub-workflow's webhook trigger configuration. This allows you to send a sample payload to the workflow, simulating the data structure it expects from the main workflow. (While not mandatory, this step is highly recommended.)


  5. Switch back to the main workflow and use the Test and Debug feature.


  6. Place a sample Excel file containing data in the monitored folder.
  7. The main workflow will process the file, extract data from each row, and send the sample payload to the sub-workflow using the webhook URL.

  8. Click Done, and we've successfully tested the webhook trigger. We can now use the data from the payload in subsequent workflow actions to process it further.
3. Build the workflow
In this workflow, we'll define the actions that we want to perform on each Excel row. For example, you might want to fill out web forms, update databases, or send emails based on the data in each row.

An example of filling out a web form
  1. To automate web form filling, we'll use the RPA Recorder. Click on RPA Recorder, then Web Browser. Also ensure you have the Zoho RPA Chrome extension installed
  2. Use the web recorder to capture the steps involved in filling out the web form.
  3. Record actions like navigating to the website, typing data into input fields, and submitting the form.
  4. Stop the recording once you've captured all the necessary steps.


  5. Next, confirm the steps you recorded using the web recorder. If you need to delete any steps, you can do it from this screen. Alternatively, you can re-record, cancel this process, or start again.


  6. Edit the recorded steps, configure them with the input payload data from the initial webhook trigger test, and save the changes. Then thoroughly test the workflow to ensure it works as expected.


  7. Refine the workflow as needed, adding error handling and logging mechanisms.
  8. Lastly, activate both workflows. Whenever a new file is created in the specified folder, the main workflow will read the Excel sheet and then trigger the sub-workflow to fill out the web form for each row of Excel data. 


    1. For more details, refer to the sample bot execution below:






      Create. Review. Publish.

      Write, edit, collaborate on, and publish documents to different content management platforms.

      Get Started Now


        Access your files securely from anywhere

          Zoho CRM Training Programs

          Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

          Zoho CRM Training
            Redefine the way you work
            with Zoho Workplace

              Zoho DataPrep Personalized Demo

              If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

              Zoho CRM Training

                Create, share, and deliver

                beautiful slides from anywhere.

                Get Started Now


                  Zoho Sign now offers specialized one-on-one training for both administrators and developers.

                  BOOK A SESSION







                              Quick LinksWorkflow AutomationData Collection
                              Web FormsRetailOnline Data Collection Tool
                              Embeddable FormsBankingBegin Data Collection
                              Interactive FormsWorkplaceData Collection App
                              CRM FormsCustomer ServiceForms for Solopreneurs
                              Digital FormsMarketingForms for Small Business
                              HTML FormsEducationForms for Enterprise
                              Contact FormsE-commerceForms for any business
                              Lead Generation FormsHealthcareForms for Startups
                              Wordpress FormsCustomer onboardingForms for Small Business
                              No Code FormsConstructionRSVP tool for holidays
                              Free FormsTravelFeatures for Order Forms
                              Prefill FormsNon-Profit
                              Forms for Government
                              Intake FormsLegal
                              Mobile App
                              Form DesignerHR
                              Mobile Forms
                              Card FormsFoodOffline Forms
                              Assign FormsPhotographyMobile Forms Features
                              Translate FormsReal EstateKiosk in Mobile Forms
                              Electronic FormsInsurance
                              Drag & drop form builder

                              Notification Emails for FormsAlternativesSecurity & Compliance
                              Holiday FormsGoogle Forms alternative GDPR
                              Form to PDFJotform alternativeHIPAA Forms
                              Email FormsWufoo alternativeEncrypted Forms
                              Accessible FormsTypeform alternativeSecure Forms

                              WCAG

                                          Create. Review. Publish.

                                          Write, edit, collaborate on, and publish documents to different content management platforms.

                                          Get Started Now






                                                            You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                                Manage your brands on social media

                                                                  Use cases

                                                                  Make the most of Zoho Desk with the use cases.

                                                                   
                                                                    

                                                                  eBooks

                                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho Desk.

                                                                   
                                                                    

                                                                  Videos

                                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho Desk.

                                                                   
                                                                    

                                                                  Webinar

                                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                                   
                                                                    
                                                                  • Desk Community Learning Series


                                                                  • Meetups


                                                                  • Ask the Experts


                                                                  • Kbase


                                                                  • Resources


                                                                  • Glossary


                                                                  • Desk Marketplace


                                                                  • MVP Corner



                                                                    Zoho Sheet Resources

                                                                     

                                                                        Zoho Forms Resources


                                                                          Secure your business
                                                                          communication with Zoho Mail


                                                                          Mail on the move with
                                                                          Zoho Mail mobile application

                                                                            Stay on top of your schedule
                                                                            at all times


                                                                            Carry your calendar with you
                                                                            Anytime, anywhere




                                                                                  Zoho Sign Resources

                                                                                    Sign, Paperless!

                                                                                    Sign and send business documents on the go!

                                                                                    Get Started Now




                                                                                            Zoho TeamInbox Resources





                                                                                                      Zoho DataPrep Demo

                                                                                                      Get a personalized demo or POC

                                                                                                      REGISTER NOW


                                                                                                        Design. Discuss. Deliver.

                                                                                                        Create visually engaging stories with Zoho Show.

                                                                                                        Get Started Now









                                                                                                                            • Related Articles

                                                                                                                            • MS Excel actions

                                                                                                                              Excel automation in Zoho RPA lets you optimize and automate a wide range of data-related tasks, such as data extraction, data transformation, data reporting, data-driven decision-making, and data filtering. This category of RPA actions will help ...
                                                                                                                            • How to loop through elements in Web pages

                                                                                                                              This guide will help you understand how we can loop through elements in webpages. Web data is incredibly diverse, and while tables are a common format, much of the information we need to interact with or extract isn't always tabular. Mostly, data ...
                                                                                                                            • Introduction to Zoho RPA

                                                                                                                              What is RPA? Robotic Process Automation (RPA) is a software technology that automates business processes by deploying software robots to mimic human-like interactions on applications. RPA bots can interact with any application or system based on its ...
                                                                                                                            • RPA Agent for Windows

                                                                                                                              What is an RPA Agent? RPA agents are software programs that run on desktop machines to automate tasks. They are the core component of the RPA platform that executes automation actions. Every machine that needs to run automation requires an RPA agent. ...
                                                                                                                            • RPA flow

                                                                                                                              What is an RPA flow? RPA flows are like processes or workflows that you can create to automate tasks. An RPA flow is made of a trigger and one or more actions. The trigger initiates the flow, and the actions are the tasks that are executed by the ...
                                                                                                                              Wherever you are is as good as
                                                                                                                              your workplace

                                                                                                                                Resources

                                                                                                                                Videos

                                                                                                                                Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                                eBooks

                                                                                                                                Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                                Webinars

                                                                                                                                Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                                CRM Tips

                                                                                                                                Make the most of Zoho CRM with these useful tips.



                                                                                                                                  Zoho Show Resources