JSON Template Generator: Google Sheet for Creating Webhook Templates

Sometimes you have to map a LOT of columns from one table to another and create a really big JSON template.

I had to do a table with over 100 columns, so I built a template generator to provide a dropdown menu of columns and add all the extra characters.

Just paste in your two rows of column headers, and use the dropdown to finish generating your template.


The sheet is public, but view-only. Copy the template to your GDrive to use.

8 Likes

This is very handy. I usually do these in Notepad++ but will switch to this method. Thanks @GreenFlux :pray:

1 Like

@Bellave_Jayaram
I have created a copy of this sheet under gDrive > able3ventures. FYI.

2 Likes

@GreenFlux
In your gSheet, there is a TEMPLATE sheet. Provided you place below sheet formula in [C1] cell, it will eliminate the last comma (,) in the generated payload and also eliminate the empty payload generation in blank cells:

={"Template Row";ARRAYFORMULA(IF(LEN(A2:A),IF(LEN(A3:A),""""&A2:A&""""&": "&""""&"<<["&B2:B&"]>>"&""""&",",""""&A2:A&""""&": "&""""&"<<["&B2:B&"]>>"&""""),""))}

2 Likes

@GreenFlux
It can even be re-arranged like this:


Sheet expression in [C1]


={"Template Row";ARRAYFORMULA(IF(LEN(A2:A),""""&A2:A&""""&": "&""""&"<<["&B2:B&"]>>"&"""",""))}

Sheet expression in [D1]


="{"&CHAR(10)&JOIN(","&CHAR(10),INDIRECT("C2:"&ADDRESS(ARRAYFORMULA(IFNA(MATCH(2,1/(C:C<>"")))),3,4,TRUE)))&CHAR(10)&"}"

which will produce a concatenated payload with the correct syntax

4 Likes

Nice touch! Thanks, @LeventK I updated the public version.

2 Likes

Here’s a related tip for generating a list of all columns in your app. It works well with the template in this post because you need a list to feed the dropdowns anyway.

1 Like