Skip to main content

HTML Table in Ampscript

Rafal Wolsztyniak

Scroll of Wisdom

Tabularize all the things!

If you find yourself building internal tools like for non-SFMC users, you might need to display some data from SFMC in an table (either on a CloudPage or sent in an email to your team).

Rather than reinvent the wheel each time the need arises, I decided to build a reusable snippet that does the following:

  • builds a HTML table ready to be placed anywhere on the page with a single variable
  • uses both <th> and <td> HTML elements for improved readability and styling support
  • allows to easily decide what column to display and in which order they should be

See the full code here with an obligatory BuildRowsetFromJSON reference: Ampscript HTML Table