logo
search
Others

How to Remove Apply to Each in Power Automate Excel Flows

Elise WilliamsElise Williams Oct 15, 2026 868 views

Question details

The user wants to prevent Power Automate from automatically wrapping Excel Office Script actions in an Apply to each loop.

How to Remove Apply to Each in Power Automate Excel Office Scripts
Product
Power Automate & Microsoft Excel
Device & OS
not provided
Scenario
Running an automated flow to convert CSV to Excel or process data using Office Scripts.
Observed behavior
Power Automate automatically adds an Apply to each loop when receiving an array from file actions, causing the flow to slow down, time out, or throw Excel connection errors.
Before you start

Confirm whether your workflow is intended to process multiple files or just a single specific file. If only one file is expected, you can safely bypass the automatic loop by using exact identifiers.

Solution 1Recommended

Use Single File Identifier Instead of Dynamic Array

Prevent Power Automate from triggering the loop by providing an exact file identifier or using expressions to extract a single item from the array.

Power Automate automatically creates an 'Apply to each' loop whenever it detects that an input is formatted as an array (a list of items), even if that list only contains one item. By manually specifying that you only want the first item, you can break the loop.

1
Remove the existing loop

Drag your 'Run script' (Office Scripts) action outside of the 'Apply to each' block, then delete the 'Apply to each' block entirely.

2
Inspect dynamic content

Instead of selecting the default dynamic array (like 'value' from a 'List files in folder' action), click 'See more' to find specific file properties.

3
Apply the first() expression

If you must use the output of an array action, click on the input field, switch to the 'Expression' tab, and use the first() function. For example: first(outputs('List_files_in_folder')?['body/value'])?['Id'] to isolate a single file without triggering a loop.

Use Single File Identifier Instead of Dynamic Array
Bypass Automatic Loops: Using exact expressions completely stops Power Automate from assuming a loop is needed, resolving execution timeouts instantly.
Free Microsoft Office alternative

Process Spreadsheets Faster with WPS Office

Struggling with complex Power Automate workflows, execution timeouts, and Office Script connection errors? Try WPS Office. It provides a lightweight, highly compatible, and user-friendly spreadsheet environment for all your data processing tasks without the heavy cloud infrastructure limitations.

  1. 1. Download the software: Visit the official WPS website and download the free WPS Office suite.
  2. 2. Install WPS Office: Run the installer and follow the quick on-screen instructions.
  3. 3. Open your files: Open your CSV or Excel files directly in WPS Spreadsheets to edit and process your data effortlessly.
100% compatible with Microsoft Excel (.xlsx, .xls, .csv) file formats.Lightweight desktop application with fast, reliable local processing—no cloud connection timeouts.Built-in advanced formulas and data processing tools to handle large datasets efficiently.Free to download and easy to deploy across Windows, Mac, Linux, iOS, and Android.
microsoft office alternative - wps office

Frequently Asked Questions

Why does Power Automate automatically add an Apply to each loop?

Power Automate automatically adds this loop whenever you map dynamic content that comes from an array (a list of items). Even if your folder only contains one file, the 'List files' action outputs an array, prompting the system to loop through the results.

How do I fix Excel Office Script timeout errors in Power Automate?

Timeout errors often occur because the script is inside an 'Apply to each' loop running across multiple files simultaneously. Removing the loop using the first() expression or setting the loop's concurrency control to 1 will resolve most timeout issues.

Can I convert CSV to Excel without using Office Scripts?

Yes. While Office Scripts are commonly used in Power Automate for this task, you can also use third-party connectors or premium actions like 'Create table' in Excel Online to handle basic CSV data mapping without writing custom TypeScript.

What is the first() expression in Power Automate?

The first() expression is a formula used to extract only the very first item from an array. Using this on a file list output allows you to pass a single file identifier to subsequent actions, completely bypassing the need for an Apply to each loop.