Power Automate: Understanding how to use JSON [Power Automate Basics Series - Ep. 6]
Power Automate: Understanding Apply to Each [Power Automate Basics Series - Ep. 5]
Power Automate, a tool designed to automate workflows, offers various functionalities to make repetitive tasks more efficient. One of the key features for automating tasks involving lists or tables is the "Apply to Each" control. In this blog post, Jonathon Silva, a Power Automate expert, dives into how the "Apply to Each" feature works, particularly within the context of handling data from Excel and SharePoint.
What is "Apply to Each"?
The "Apply to Each" feature in Power Automate allows users to loop through a list or array and perform actions on each individual item in that list. This can be extremely useful for scenarios where you need to process multiple entries, such as sending emails, creating SharePoint items, or making API calls for each row in a data table.
Key Benefits of Using "Apply to Each":
- Automates repetitive tasks, reducing manual intervention.
- Allows you to handle multiple data entries efficiently.
- Ideal for situations like syncing data from Excel to SharePoint, or sending emails based on row-specific data.
Setting Up "Apply to Each" in Power Automate
In this walkthrough, Jonathon uses an Excel spreadsheet to demonstrate how the "Apply to Each" control is integrated into a flow. Here are the main steps to set up and configure it:
1. Prepare Excel File:
- The Excel file must be formatted as a table for Power Automate to interact with it. Jonathon uses an Excel table called "Table1" which contains three columns and four rows.
- Ensure the data is structured correctly, with headers to identify the content.
2. Create Power Automate Flow:
- Jonathon begins by connecting Power Automate to the Excel file, selecting the "List rows present in a table" action.
- This action pulls in all rows from the table, which will be processed one by one.
3. Add "Apply to Each":
- After retrieving the data, Jonathon adds the "Apply to Each" control to iterate over each row in the Excel table.
- Power Automate will perform specific actions (like creating a SharePoint item) for each row, one at a time.
4. Map Data to SharePoint:
- For each row in the Excel table, Jonathon maps the data (like name, status, and title) to corresponding fields in a SharePoint list.
- This step ensures the data is transferred seamlessly from Excel to SharePoint.
Using Dynamic Content with "Apply to Each"
One of the powerful features of "Apply to Each" is the ability to use dynamic content from the Excel table in subsequent actions. For example, in Jonathon's flow, he creates a SharePoint item by referencing dynamic content such as "name" and "status" for each row.
Benefits of Dynamic Content:
- Simplifies automation by allowing you to pull in data from previous steps directly into new actions.
- Reduces errors by eliminating the need for manual data entry or hardcoded values.
Testing and Results
Jonathon demonstrates testing the flow by manually triggering it. The "Apply to Each" loop processes each row and creates SharePoint items as expected. He verifies this by checking the SharePoint list, where new items are added for each Excel row.
Key Takeaways from the Test:
- Each row in Excel results in a new item in SharePoint.
- The flow loops through all rows in the table and applies the steps consistently.
Sending Emails with "Apply to Each"
Jonathon also shows how "Apply to Each" can be used to send multiple emails. After setting up the flow to send an email for each row in Excel, the system automatically creates four separate emails (one for each row).
- Dynamic Email Generation: The flow uses dynamic content (e.g., "assigned to" and "assignment details") to customize each email.
- Automatic Looping: Instead of manually creating separate email actions, Power Automate automatically applies the email action to each row, ensuring personalized communication.
Troubleshooting and Best Practices
While "Apply to Each" is a powerful tool, there are a few things to keep in mind:
- Ensure your data is properly structured (e.g., Excel table formatting) to avoid issues in data retrieval.
- Be mindful of performance limitations, especially when dealing with large datasets, as looping over many items can slow down the flow.
Conclusion
The "Apply to Each" control in Power Automate simplifies the process of automating repetitive tasks involving multiple data entries. By setting up loops, users can automate actions such as creating SharePoint items, sending emails, or even processing API calls for each item in a list. Whether you are working with small data sets or larger workflows, "Apply to Each" can enhance productivity and streamline operations.
Jonathon’s demonstration highlights just how easy it is to implement this feature in Power Automate. By leveraging dynamic content and understanding the flow structure, you can create powerful automations that save time and reduce errors.
Don't forget to check out the Pragmatic Works' on-demand learning platform for more insightful content and training sessions on Power Automate and other Microsoft applications. Be sure to subscribe to the Pragmatic Works YouTube channel to stay up-to-date on the latest tips and tricks.
Sign-up now and get instant access
ABOUT THE AUTHOR
Jonathon Silva is a Trainer for Pragmatic Works, specializing in the Power Platform. He graduated from James Madison University in 2011, has a master’s degree in Education, and comes with 9 years of teaching experience in high school economics and history. Jonathon has consistently been recognized as a top educator in the field of history and leader in curriculum development. His primary focus is helping our customers learn the ins and outs of Power Apps and Power BI.
Free Community Plan
On-demand learning
Most Recent
- Power Automate: Understanding Apply to Each [Power Automate Basics Series - Ep. 5]
- Azure Synapse Analytics: Data Flows [Introduction to Synapse - Ep. 16] - Intro to Data Flows
- Power BI: Row-Level Security with Multiple Conditions
- Azure Synapse Analytics: [Introduction to Synapse - Ep. 17] - Introduction to Dedicated Pools
private training

Leave a comment