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 / power automate flow fo...
Power Automate
Answered

power automate flow for empty excel attachment

(0) ShareShare
ReportReport
Posted on by 2
Can power automate check an email attachment of a excel document to see if it contains any data.
 
I received a daily email with the excel attachment, most days it's an empty file and I would like to check it and if empty then move it to my deleted email folder. 
 
is this possible with power automate 
 
I have the same question (0)
  • Verified answer
    MParikh Profile Picture
    521 Super User 2026 Season 1 on at
    HI @MH-11031519-0,
     

    Yes, Power Automate can do this. Here is one approach using cloud flows.

    The flow logic

    Trigger: "When a new email arrives" (Outlook connector), filtered to emails with attachments.

    Then:


    1. Add a condition to check if the attachment filename ends with .xlsx or .xls.

    2. Use the "Get attachment content" action to retrieve the file bytes.

    3. Run a "Create file" action in OneDrive/SharePoint to temporarily save the attachment.

    4. Use the Excel "List rows present in a table" action on that saved file.

    5. Check if the returned rows array is empty (length(body('List_rows')?['value']) equals 0).

    6. If empty, use the "Move email" action to send it to your Deleted Items folder.

    7. If not empty, leave it or process it normally.
     

    One thing to know

    The Excel "List rows" action requires the data to be in a named Table inside the sheet, not just raw cell data. If the daily file uses plain ranges instead of a formatted Table, the action will error out. In that case, use "Run script" (Office Scripts) to count used rows and return a boolean instead.

    Alternative for unstructured files

    Office Scripts Action: Write a short script that checks sheet.getUsedRange() and returns whether it is null or has zero rows. Pass that result back to your condition step.

    The move-to-deleted step

    Use the Outlook "Move email" action. Set the destination folder to "DeletedItems". You will need the email ID from the trigger output.

    This works reliably for daily automated emails. The main failure point is the Excel table requirement, so check the attachment format first before building the flow.


    Thank you! 
    Proud to be a Super User!
    📩 Need more help?
    ✔️ Don’t forget to Accept as Solution if this guidance worked for you.
    💛 Your Like motivates me to keep helping

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard