logo
search
Others

How to Fix Power Automate Apply to Each Array Error in Microsoft Forms

Steve KSteve K Sep 30, 2026 868 views

Question details

The user is unable to pass an array variable to the 'Apply to each' action in Power Automate when building a flow to automatically grade text answers.

How to Fix Power Automate Apply to Each Array Error in Microsoft Forms
Product
Microsoft Power Automate / Microsoft Forms
Device & OS
not provided
Scenario
Automating the assessment of Microsoft Forms written responses by detecting specific keywords, assigning marks, and flagging answers based on the text.
Observed behavior
The 'Apply to each' action rejects the provided variable, indicating that it is not receiving a valid array structure from the Forms response or previous steps.
Before you start

Ensure you have access to edit your Power Automate flow and can run a test submission from your Microsoft Form to view the raw JSON outputs of your workflow.

Solution 1Recommended

Verify Variable Type and Array Initialization

Ensure that the variable passed to the 'Apply to each' action is explicitly formatted and recognized as an array.

Power Automate requires a strictly defined array format (a list of items) for loops to function. When extracting data from Microsoft Forms, the output is often a single text string rather than an array, which causes the 'Apply to each' action to fail.

1
Check variable initialization

In your flow design, locate the 'Initialize variable' action where you define your keywords or responses. Ensure the 'Type' dropdown is set strictly to 'Array'.

2
Review Parse JSON output

If you are extracting multiple answers from Forms, use a 'Parse JSON' action. Check the JSON schema to ensure the specific output field is defined as an array type.

3
Use split expressions for text strings

If your Microsoft Forms response returns a single string separated by commas, click on the 'Apply to each' input box, navigate to the Expression tab, and use the split function: split(variables('YourVariable'), ',') to convert the string into a valid array.

Community Support: If the array structure involves complex nested JSON from Microsoft Forms, consider posting a sanitized screenshot of your flow design and sample data in the Microsoft Power Automate community for advanced troubleshooting.
Free Microsoft Office alternative

Try WPS Office for Efficient Form Data Processing

While Power Automate handles automated workflows, managing, analyzing, and formatting your collected form data is much easier with WPS Office. As a lightweight and free alternative to Microsoft Office, WPS Spreadsheet offers powerful data analysis tools that are fully compatible with Excel formats.

  1. 1. Export your form responses: Download your Microsoft Forms assessment responses as an Excel (.xlsx) or CSV file.
  2. 2. Open the data in WPS Spreadsheet: Launch WPS Office and open the exported file to view all written responses in a clear, structured grid.
  3. 3. Analyze and grade keywords: Use WPS Spreadsheet formulas or the Find feature to quickly detect keywords, calculate grades, and flag alternative answers directly in your workbook.
Fully compatible with Microsoft Excel (.xlsx) and CSV files for seamless form data import.Use built-in formulas like COUNTIF and SEARCH to analyze keyword frequencies and assessment scores without complex automation flows.Lightweight software with a familiar interface that requires zero learning curve.Free to download with integrated spreadsheet, document, presentation, and PDF editing tools.
microsoft office alternative - wps office

Frequently Asked Questions

Why does Power Automate say my variable is not an array?

This usually happens if the data extracted from Microsoft Forms is passed as a plain text string instead of a structured array format. You must convert the string into an array using the split() function or a 'Parse JSON' action before using it in a loop.

Can I use Power Automate to grade long text answers in Microsoft Forms?

Yes, you can extract the text from the form submission and use an 'Apply to each' loop alongside conditional actions (like 'contains') to search for specific keywords and assign points based on those matches.

How do I manually format an array for keywords in Power Automate?

To format an array manually, initialize an Array variable and format your values enclosed in square brackets, separated by double quotes and commas, for example: ["keyword1", "keyword2", "keyword3"].