Skip to main content

Build an HTML table from records

Turn a list of records into a table for an email or PDF. Collect the records, link a table row to the list, and Tape adds one row for each record.

Written by Leo

The email and PDF editors can insert a table. Link a table row to a list of records with Insert, and Tape adds one row for each record. If you need full control, you can also build the table as HTML text (the code that describes the table). This page shows the steps, using a daily list of overdue invoices as the example.

The preview of the Send an email action in the Weekly expense list automation after Simulate variables: a table with the columns Expense and Amount and one row for each collected expense, from Client dinner to Team offsite venue deposit

Note:

  • A table can only have as many rows as the list has records. A single action collects at most 1,000 records.

  • A run stops after 1,000 actions or three minutes. Long lists can reach these limits. Learn more about limits →

Collect and sort the records

To collect the records for your table:

  1. Open the automation and select Add action → Search for records.

  2. Select the database app, for example Invoices.

  3. Select Add filter and add your condition, for example Status is Overdue.

  4. Select Add action → Sort collected, Tape preselects the list from step 1 and adds a first sort row. Select the field name in that row and choose a field, for example Due date.

Adding Search for records in Expenses with the filter Status is Submitted, then adding Sort collected and changing its sort field from Expense to Date

The table rows follow the order of the sorted list. Learn more about collected records →

Add a table to the email or PDF

To add a table with one row for each record:

  1. Select Add action → Send email or Create PDF.

  2. In the message or the PDF content, select Open in fullscreen to show the menus. Then select Table → Table and choose the number of rows and columns. You can also use Insert → Table.

  3. Use the first row for the column names, for example Invoice and Amount.

  4. Hover over the second row, then select Insert next to it. The tooltip says Select a variable with multiple items to be inserted as rows below. Choose the sorted list.

  5. Type @ in a cell of the linked row and choose fields from the collected records, for example Collected / Invoice → Amount. Each row shows the values of one record. Values from other groups, such as the record that started the automation, are the same in every row.

Inserting a table in the fullscreen editor of the Weekly expense list automation, adding the columns Expense and Amount, linking the second row to the Expenses list with Insert, and inserting @Collected / Expense / Expense and @Collected / Expense / Amount from the @ menu

Tape repeats the linked row for every record in the list. To remove the link, select Clear insert.

Select Show preview → Simulate variables to check the table before you save. Learn more about formatting emails and PDFs →

Build the table as HTML text

If you need full control over the table, you can write it as HTML text with Perform calculation and insert the result:

  1. Select Add action → Perform calculation.

  2. In Code, enter the table as text, for example "<table><tr><th>Invoice</th><th>Amount</th></tr></table>".

  3. Select the name next to and save result in (Calculation result) and type a new name, for example Table.

  4. In Send email or Create PDF, type @ and choose the variable.

Adding Perform calculation, typing the table as text in Code, and renaming Calculation result to Table

Tape inserts the result of Perform calculation as HTML, so the email shows a table. To repeat a row for every record in a list, use a table in the message with a linked row instead, as described above.

Let's look at an example

Let's say your finance team wants a daily list of overdue invoices. Here's how:

  1. Set the trigger to On a scheduled time or interval and choose every day at 8:00 AM.

  2. Collect the overdue invoices and sort them by Due date.

  3. Select Add action → Send email and enter your finance lead in To.

  4. Insert a table in the message and type the column names in the first row.

  5. Link the second row to the sorted list with Insert, and fill its cells with the invoice values.

  6. Select Create automation.

Every morning, the finance lead gets one email with all overdue invoices in a table.

Group records under a parent record

To show records of one database app under a parent record, for example tasks under each project, collect the parent records with Search for records. Link the table row to that list with Insert, and in one cell insert the relation field to the child database, for example @Collected / Project / Tasks. Each project gets its own row, and its tasks appear in that cell, separated by commas.

Table errors

  • The email shows HTML code instead of a table. Tape inserts the result of Perform calculation as HTML on its own. If you see code, check that you inserted the calculation result and not a single line text field.

  • The table has no rows. The list is empty. Check the filter on Search for records.

  • The run stops before the end. A run ends after three minutes or 1,000 actions. Collect fewer records, or split the work into batches. Learn more about batches →

Learn more

FAQs

Can I add a column that shows a link to the record?

Yes, type a word such as Open in a cell of the linked row and select it. In the fullscreen editor, select Insert → Link, then type @ in the link address and choose Record URL from the collected records. Learn more about record values →

Can I build a table in Excel or CSV format?

No, Tape has no action that creates Excel or CSV files. You can put the table in an email or PDF.

Can I add a chart?

No, there is no automation action that creates charts. Automations can put tables and text into an email or PDF.

Do I need to know HTML?

No. A table in the email or PDF editor needs no HTML. You only need HTML if you build the table as text with Perform calculation. Then the table needs the tags <table>, <tr>, <th>, and <td>.

Are you a developer using the Tape API for automations?

The automation API has its own documentation for developers. Full reference: for_loop in the developer docs →

Still have questions? Find answers and get help from community experts in the Tape community →

Did this answer your question?