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 / Checking if Excel has ...
Power Automate
Answered

Checking if Excel has a table without using FOR EACH loop.

(1) ShareShare
ReportReport
Posted on by 2

I am trying to check if an excel document has a table, and if it doesn't create one. If it does, don't. The problem I am having is that if I use dynamic content, it goes into for-each loop and the condition will always fail, and is VERY slow.

 

The Excel document I am working with has 1300 rows.... so the loop is painfully slow. So, I am trying to use expressions manually to skip the for-each. Its a singular check, and shouldn't have to go through each row looking for a table.

 

Get tables from excel for business (works) -- > Returns [] when no table or ['Table1'] when there is a generic table

 

Condition:

string(empty(body('Get_tables')?['Value'])) -- > is equal to -- > True | Always returns false.

 

OR

 

empty(body('Get_tables')?['Value']) -- > is equal to -- > True | Always returns false

 

OR

 

body('Get_tables')?['Value'] -- > is equal to -- > empty() or null | Fails, doesn't like the check

 

My question is, how do I use the returned value of [] from Get Tables to trigger a TRUE condition and create a table? Future more, if the excel document has a table and returns ['Table1'], don't. It will return FALSE in the condition, but seeing how when its empty it also returns false, I don't trust that its working correctly.

 

Capture.PNG

Categories:
I have the same question (0)
  • jwhite Profile Picture
    191 on at

    Hi @matchrocket,

    Try using a condition to check the length of the array returned by "Get tables" as below:

     

    I set up what is hopefully a simple version of what you're trying to do, if not let me know if I misunderstood:

    GetTables.png

     

    The expression I have used in the condition is:

    length(body('Get_tables')?['value'])

    which checks the length of the array. As we are just checking the array and not the contents of the array there is no need for a loop.

     

    Let me know if this helps!

  • Verified answer
    v-alzhan-msft Profile Picture
    Microsoft Employee on at

    Hi @matchrocket ,

     

    Have you taken a try with @matchrocket 's solution?, @matchrocket 's solution is works, please take a try with it and your poblem could be solved.

     

    length(body('Get_tables')?['value'])

    Best regards,

    Alice       

     

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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
Vish WR Profile Picture

Vish WR 382

#2
Valantis Profile Picture

Valantis 370

#3
David_MA Profile Picture

David_MA 300 Super User 2026 Season 1

Last 30 days Overall leaderboard