How to add hyperlink in the ‘Create HTML table’ Power Automate action

“I’ve got all the items in a single HTML table, but I’d like to include also clickable hyperlink to the items, is that doable with Power Automate?”


The Power Automate action ‘Create HTML table’ should allow you to display data in an ‘easy to read’ format. But as already shown on the multiple people picker or choice SharePoint columns, sometimes it’s not that easy. If you use the HTML table to send data to users, you might need to format them it a bit. And another value that needs formatting is the link to the related item / document. You probably don’t want to send the whole link, and this post will show you how to avoid it.

Power Automate HTML table hyperlink

Note: All the examples below will use a SharePoint list as the data source.

Format the link with HTML tags

Since you’re building an HTML table, you should stick to that format and build the link in HTML format too.

<a href="Link">Text to display</a>

Using Power Automate, such a string can be built with the concat(…) expression from the various pieces.

concat('<a href="', [Link], '">[Text]</a>')

Replacing the placeholders with actual values, the expression might look like below.

concat('<a href="', item()?['{Link}'], '">Link to item</a>')

But this is only the first step of the solution. If you end here, you’ll make the link even uglier as you can see below. The action took the string as it is, without applying the HTML tags.

What happened is that the HTML table doesn’t want you to add another HTML tags as they could break the table. To stay safe it replaced the < with &lt;, > with &gt; and with &quot;. It’s just another representation for these characters, but it’s enough for the table to ignore the additional HTML code with the hyperlink. That leads to the 2nd step, you must replace the characters back.

Return the <, > and ” characters

To hide the links and show only the text (with link in the background), you must get back the <, > and ” characters. That means using the replace(…) expression on the ‘Create HTML table’ output to replace the &lt;, &gt; and &quot;.

1. replace(body('Create_HTML_table'),'&lt;','<')
2. replace(body('Create_HTML_table'),'&gt;','>')
3. replace(body('Create_HTML_table'),'&quot;','"')

or all together in a single expression:
replace(replace(replace(body('Create_HTML_table'),'&lt;','<'),'&gt;','>'),'&quot;','"')
Power Automate HTML table hyperlink

Use another dynamic content as the text

Now, when you know how to hide the link behind a text, you can adjust also the text itself. The easiest way is to have a static text for the link, but it’s not necessary. You can use another dynamic content as the text too, just add it to the concat(…) expression, e.g. the item title.

concat('<a href="', item()?['{Link}'], '">', item()?['Title'], '</a>')
Power Automate HTML table hyperlink

Summary

I’d say this post is an addition to the previous post on formatting the HTML table. When you use Power Automate to send reminders or reports with an HTML table, it makes sense to include also hyperlink. It’ll change a purely information email into an actionable email, and the recipients will save a lot of ‘search time’. Quick overview of the most important values and a link to see them all.


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.

One Comment

Add a Comment

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