I am trying to write a script which creates a table in a google docs file with the results after a user has submitted a form.
In the form the user can enter up to 16 invoices and 16 payments; however on my summary pdf I don't want to display a table full of empty cells if the user has only entered one invoice.
I tried to write an if statement to say "If "invoice number" cell is not empty, then create a table row, if not, do nothing", but it creates the rows anyway even when the cells are empty and I can't quite figure out why.
Anyone have any ideas? Here's the code:
var invoiceData = [['Invoice Number', 'Invoice Amount', 'Due Date of Invoice']];
table1 = copyBody.appendTable(invoiceData);
var tab1row1=table1.appendTableRow();
if (sheet3.getRange("A20").getValue() ==! 0);{
tab1row1.appendTableCell(sheet3.getRange("A3").getValue());
tab1row1.appendTableCell("£" + sheet3.getRange("B3").getValue());
tab1row1.appendTableCell(sheet3.getRange("C3").getValue());
And the same code repeated for rows up to row 16 (but with changed numbers obviuosly).
The cell A20 (which is the one specified within the IF statement) is a cell containing the formula =VALUE(A3).
Thank you in advance.