Skip to content

Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Problems
  • Triggers
  • Application specific solutions
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Resources
Menu

Why is Power Automate sending an HTML table even when it’s empty?

Posted on January 5, 2022January 5, 2022 by Tom

“I use Power Automate to send emails with an HTML table, but it keeps sending them even when the table is empty, how can I avoid that?”


If you use Power Automate to send email reports or reminders, it’s a nice touch to format the data in an HTML table. It’s so much easier to read the data if it’s in a table. But what if there’s no data to display in the table? The flow will send the table anyway, but this time it’ll include only the table header. Such email doesn’t have any information value, and probably won’t make any recipient happy. If such situation happens, you shouldn’t send that email at all.

Check if the table is empty

Before you send an email, you should check if the table is not empty. And while it might look as a simple check, I’ve seen many times the same problem. Users very often add a condition to evaluate if the output from ‘Create HTML table’ is empty.

Power Automate HTML table empty

It’s the right condition, but using wrong dynamic content. The output from the ‘Create HTML action’ will never be empty. It’ll always contain the header, even if there’s no data to add.

That’s why you must go one step back. Back to the action that can return an empty value: the input of the ‘Create HTML table’. Check if it’s empty, and send the email only if it is not, e.g.

empty(outputs('Get_items')?['body/value']) <is not equal to> true
Power Automate HTML table empty

Summary

It’s always important to use the right dynamic content in the right situation. If you want to check if an HTML table is empty, you must check the output from the right Power Automate action. And it’s quite easy to identify which one it is, just check the flow run history. You’ll see that the ‘Create HTML table’ contains the table header, while the ‘Get items’ returns [] (= an empty array). That’s the action to check.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Now available:

The Ultimate Power Automate expressions cheat sheet
Equip yourself with the tool to translate your thoughts into Power Automate expressions!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Hello and welcome!

My name is Tom and I'm a business process automation consultant and Microsoft MVP living in the Czech Republic. I’ve been working with Microsoft technologies for almost 10 years, currently using mainly Power Automate, SharePoint, Teams, and the other M365 tools.

I believe that everyone can automate part of their work with the Power Automate platform. You can achieve a lot by "clicking" the flows in the designer, but you can achieve much more if you add a bit of coding knowledge. And that's what this blog is about.

To make the step from no-code Power Automate flows to low-code flows: using basic coding knowledge to build more complex yet more efficient flows to automate more of your daily tasks.

  • Format results of date calculation in SharePoint columnJune 29, 2022
  • Why is your Power Automate flow creating duplicatesJune 26, 2022
  • How to create a unique identifier in your Power Automate flowJune 22, 2022
  • How to assign custom SharePoint permission level with Power AutomateJune 19, 2022
  • Remove permissions from a specific SharePoint user with Power AutomateJune 15, 2022

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

© 2022 Let's POWER Automate | Powered by Superbs Personal Blog theme