web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to extract error r...
Power Automate
Answered

How to extract error rows from an Excel file in Power Automate Desktop?

(1) ShareShare
ReportReport
Posted on by 88

Hi everyone,

 

I am currently working with Power Automate Desktop and would appreciate your help.

 

Scenario:

I have an ETL process that outputs results into an Excel file instead of a log file. The Excel file contains multiple rows, including status or messages such as “Success” and “ERROR”.

 

What I want to achieve:

I want to create a flow that checks the ETL result.

If the result is “Failed”, I would like to extract only the rows in the Excel file that contain error information (e.g., rows with “ERROR”) and use them (for example, in an email notification).

 

What I have tried:

 

  • Used “Launch Excel” and “Read from Excel worksheet” to read the data

  • However, I am not sure how to filter or extract only the rows that contain “ERROR”

 

 

Question:

What is the best way in Power Automate Desktop to filter or extract specific rows from a DataTable (e.g., rows containing “ERROR”)?

 

Should I use loops (For Each), conditions (If), or is there a more efficient way?

I am a beginner so step by step guide would be greatly appreciated

 

Thank you!

I have the same question (0)
  • Verified answer
    11manish Profile Picture
    853 on at
    You’re on the right track — and yes, this is a very common pattern in ETL validation using Power Automate Desktop.
     
    Let me show you the best (clean + efficient) approach, not just loops 
    Goal
    From Excel → DataTable:
    Row1 → Success  
    Row2 → ERROR: File missing  
    Row3 → Success  
    Row4 → ERROR: Invalid data  
     
     
    You want:
    • Row2, Row4 (only ERROR rows)
    Best Approach (Recommended)
    Use Filter Data Table action (No loop needed )
    Steps
    1. Read Excel
    • Action: Read from Excel worksheet
    • Output → dtResults
    2. Filter rows
    • Action: Filter data table
    • Configure:
    • Input DataTable → dtResults
    • Condition:
    • ColumnName CONTAINS "ERROR"
    • Output → dtErrors
    Result:
    • dtErrors contains only error rows
    Advanced (Better detection)
    If errors are in multiple columns:
    • Contains(CurrentItem['Column1'], "ERROR") 
    • OR 
    • Contains(CurrentItem['Column2'], "ERROR")
    Next Step (Send Email)
    • Convert dtErrors → HTML:
    • Action: Convert DataTable to HTML
    • Use in email body
    Pro Tips 
    Make it case-insensitive
    Use:
    • ToUpper(Column) CONTAINS "ERROR"
    • Handle "Failed" condition first
    • Before filtering:
    • If dtResults contains "Failed"
     
    Thanks
    Manish
     
     
  • Verified answer
    Haque Profile Picture
    1,429 on at
    Hi @CU10030357-0,
     
    Here is what you can do:
     
    1. Execute ETL steps as usual. At the end, set a variable to grab the status say, etlStatus = "Success" or "Failed"  (as you maintain)
     
    2. Go for a condition check, add If block,  If etlStatus = "Failed", proceed to error extraction (happy path for your case), Else, end the flow or send a success notification (your choice).
     
    3. Let's do the error extraction . Use Launch Excel (with or without instance visibility). Use Read from Excel worksheet → store into a DataTable variable (e.g., etlResultTable).
     
    4. Let's use Filter Data Table action, Input: etlResultTable, Condition: Column[Status] = "ERROR",  Output: ErrorRowsTable, at this point you have only the rows with "ERROR".
     
    5.Let's format extract rows: Employe For Each loop through ErrorRowsTable, build a string variable to store summary say errorSummary, concatenating row details (UniqueID, Message etc. what ever you need).
     
    Set Variable errorSummary = ErrorSummary & CurrentItem["UniqueId"] & " - " & CurrentItem["Message"] & NewLine

    6. Now bring action for sending email, Send Email (may be vai Outlook connector or call cloud flow), embed errorSummary in the email body. Optionally, you can attach the Excel file too.

     

    Please let me know if these steps help?

     

     
     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!
  • CU10030357-0 Profile Picture
    88 on at
     
    Thank you so much it helped me to make the flow but I have a problem in the variables settings I think I wrote it wrong I would get a weird mails. like this ↓
    "" & CurrentItem["Original Filename"] & " - " & CurrentItem["Loading Status"] & "\n" & CurrentItem["Original Filename"] & " - " & CurrentItem["Loading Status"] & "\n" & CurrentItem["Original Filename"] & " - " & CurrentItem["Loading Status"] & "\n" & CurrentItem["Original Filename"] & " - " & CurrentItem["Loading Status"] & "\n" & CurrentItem["Original Filename"] & " - " & CurrentItem["Loading Status"] & "\n" & CurrentItem["Original Filename"] & " - " & CurrentItem["Loading Status"] & "\n" & CurrentItem["Original Filename"] & " - " & CurrentItem["Loading Status"] & "\n" & CurrentItem["Original Filename"] & " - " & CurrentItem["Loading Status"] & "\n"
     
    and i attach an image of what i wrote in my variables settings.
     
    I hope you could help me with this. Thank you so much
    IMG_2130.png
  • Verified answer
    Haque Profile Picture
    1,429 on at
     
    The expression you have written is correct, but the way you’re using it explains why you’re seeing repeated lines. Right now, you’re concatenating the same CurrentItem values multiple times in one expression, instead of letting the For Each loop iterate and append once per row.
     
     
    Initialize a variable before the loop: 
    errorSummary = ""
     
    Inside the For Each loop (over error rows)
    Use Set Variable (or Append to string variable) with:
    %errorSummary% & CurrentItem["Original Filename"] & " - " & CurrentItem["Loading Status"] & NewLine
     
    Please let me knwo if it works.
     
  • Verified answer
    11manish Profile Picture
    853 on at
     
    Why you’re getting this weird output
     
    Right now your value:
    %errorSummary% & CurrentItem["Original Filename"] & " - " & CurrentItem["Loading Status"] & "\n"
     
    is being treated as plain text, not as an evaluated expression.
     
    That’s why your email literally shows:
    • "" & CurrentItem["Original Filename"] & ...
    Fix (Correct Way)
    In Power Automate Desktop, you must:
    • Enable expression mode (fx) OR use proper % % syntax
    Correct Expression
    Use this:
    • %errorSummary% + CurrentItem["Original Filename"] + " - " + CurrentItem["Loading Status"] + NewLine
    Thanks
    Manish
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard