I have a dynamic HTML table which I want to pass its values to a Google Spreadsheet through GS code.
<div class="container">
<table style="width: auto" id="myTable" class=" table order-list">
<!-- ### INICIO DO CODIGO DA TABELA TD = TABLE DATA / TR = TABLE ROW / TH = TABLE HEADING### -->
<!-- CABEÇALHO -->
<tr>
<th>Ref.</th>
<th>Produto</th>
<th>Categoria</th>
<th>Marca</th>
<th>Tipo de Venda</th>
<th>$ Etiqueta</th>
<th>$ Real</th>
<th>Quantidade</th>
</tr>
<!-- LINHAS -->
<tr>
<td><input type="text" name="refProd" size="10" /></td>
<td><input type="text" name="nomeProd" size="30" /></td>
<td><input type="text" list="categorias" name="catProd" size="15" /></td>
<td><input type="text" list="marcas" name="fabProd" size="10" /></td>
<td><input type="text" list="carater" name="tipoVenda" size="15" /></td>
<td><input type="number" name="vendaEtiqueta" /></td>
<td><input type="number" name="vendaReal"/></td>
<td><input type="number" name="qtd" /></td>
</tr>
</table>
</div>
I've already followed this answer:
Pass HTML Table to Google Spreadsheet. Get Cell Values out of a Dynamic Table
And reached the part where I generate the array in the HTML file, but I don't know how to pass the HTML values to the GS code in a way where I can add those values to the spreadsheet. Can someone help me please? I'm a beginner in this programming world.
Thanks in advance.
In regard to your last question below:
This is one way to go. I tend to do this sort of thing server side and then pass it as an object to the html file. This is some code from a previous project of mine. It's not intended to be an exact match for your needs but you can use it as a starting point.
Google Script:
This is the Javascript that calls it:
This is the Javascript that updates the spreadsheet:
and this is the Google Script that updates the spreadsheet: