Skip to main content
Best answer

How to deal with a list of values from a previous step to get them formatted in a mail in a table?


Forum|alt.badge.img

Hi, I’m new to Zapier but I’m already familiar to process automation as I’ve used Power Automate for the last 3 years :)

Let’s assume I have a step to get rows for a GSheets. My table has 9 columns and 6 rows.
Here you can see the output of the step 5 get many spreadsheet rows

I then want to get all items for each row to be mapped with its header as GSheets cannot retrieve headers (that would be ideal to get them named as LABELS instead of 1, 2 etc.

That’s what I meant to do without success on step 6 with formatter / Line itemizer and the output looks fine.
 

But as I try to use these outputs in step 7 within the body of my Gmail message. I get them all set with comma as separator.

Any help would be appreciated as I did not find how to reading this post : 

https://community.zapier.com/how-do-i-3/how-can-i-send-a-single-gmail-with-multiple-rows-of-data-from-google-sheets-42869?postid=162607#post162607

 

Best answer by Marge

Hey ​@ELDEETIC_byLucieDUVERGER, welcome to the Community! 👋

I recommend using a Code by Zapier step to create an HTML table based on the row line items returned by the Google Sheets step. I am personally not a coder but I frequently use the “Generate with AI” feature and input a prompt detailing what I want to achieve. For example, I used the following prompt to generate an HTML table:

 

Take the row line items (COL 1, COL 2, COL 3, COL4, COL5) returned by the previous step and return the rows in an HTML table that can be inserted in the body of an email

 

COL 1, COL 2, etc. are the column headers in my worksheet. And the step previous to the Code step was the Google Sheets - Lookup Spreadsheet Rows step which returns the rows as line-items.

Could you give this a try and let me know if that works?

View original

5 replies

  • Zapier Staff
  • 38 replies
  • Answer
  • January 23, 2025

Hey ​@ELDEETIC_byLucieDUVERGER, welcome to the Community! 👋

I recommend using a Code by Zapier step to create an HTML table based on the row line items returned by the Google Sheets step. I am personally not a coder but I frequently use the “Generate with AI” feature and input a prompt detailing what I want to achieve. For example, I used the following prompt to generate an HTML table:

 

Take the row line items (COL 1, COL 2, COL 3, COL4, COL5) returned by the previous step and return the rows in an HTML table that can be inserted in the body of an email

 

COL 1, COL 2, etc. are the column headers in my worksheet. And the step previous to the Code step was the Google Sheets - Lookup Spreadsheet Rows step which returns the rows as line-items.

Could you give this a try and let me know if that works?


Forum|alt.badge.img
  • Zapier Staff
  • 9 replies
  • January 23, 2025

Hey ​@ELDEETIC_byLucieDUVERGER 

 

Welcome to the Zapier community!

 

Yes, you’re correct, and the header values aren’t included in the response from the Google Sheets step. With how fields work, if you have a field name (Enterprise) and a value associated with it that you map to a subsequent step, the field name won’t be automatically included. This means only the value of Enterprise will be added to the Gmail step, and not “Enterprise” (or the column headers which are field names in the Zap) itself.

 

I believe you could type out “Enterprise” statically on the email body for the Gmail step and then map the Enterprise field (or the field from Google Sheets) next to it. I’ve attached a screenshot of how it could look below:

 

51c553f7295c3c43f79ca3c41b55caef.png
(view larger)

 

Hope this helps!


Forum|alt.badge.img
Marge wrote:

Hey ​@ELDEETIC_byLucieDUVERGER, welcome to the Community! 👋

I recommend using a Code by Zapier step to create an HTML table based on the row line items returned by the Google Sheets step. I am personally not a coder but I frequently use the “Generate with AI” feature and input a prompt detailing what I want to achieve. For example, I used the following prompt to generate an HTML table:

 

Take the row line items (COL 1, COL 2, COL 3, COL4, COL5) returned by the previous step and return the rows in an HTML table that can be inserted in the body of an email

 

COL 1, COL 2, etc. are the column headers in my worksheet. And the step previous to the Code step was the Google Sheets - Lookup Spreadsheet Rows step which returns the rows as line-items.

Could you give this a try and let me know if that works?

Thank you Marge. Nearly forgot to quote but yeah, the method you shared worked!!!

Giving a pattern to the AI generator gave me a code that resulted in a HTML table that I was then able to insert in my mail step.


Forum|alt.badge.img
Jaaro wrote:

Hey ​@ELDEETIC_byLucieDUVERGER 

 

Welcome to the Zapier community!

 

Yes, you’re correct, and the header values aren’t included in the response from the Google Sheets step. With how fields work, if you have a field name (Enterprise) and a value associated with it that you map to a subsequent step, the field name won’t be automatically included. This means only the value of Enterprise will be added to the Gmail step, and not “Enterprise” (or the column headers which are field names in the Zap) itself.

 

I believe you could type out “Enterprise” statically on the email body for the Gmail step and then map the Enterprise field (or the field from Google Sheets) next to it. I’ve attached a screenshot of how it could look below:

 

51c553f7295c3c43f79ca3c41b55caef.png
(view larger)

 

Hope this helps!

Thank you Jaaro. I already knew how to insert static (labels from my GSheets table) info in my mail step. Just needed to get a formatted table which I did with Marge’s help.


  • Zapier Staff
  • 38 replies
  • January 23, 2025

Awesome, thank you for confirming! I am glad that worked.

Happy Zapping! ⚡