By doing the manual input tests and referencing the value from one cell to another, the format that influences the final record is that of the cell where the entree, then in your case it would still be on the form, and how is accepted this value.
EXAMPLE:
Matrícula = 0000012
-> manual entry
Before the appendRow()
: Matrícula = 12
-> reduced number for access in a "temporary cell" (I call this because I don’t know exactly how the transition from form to worksheet works before the call of the addStudent function()
After the appendRow()
: Aluno01 || 12 || 2001-06-03
Therefore, if at the time you are registering the registration the number is ignoring the zeros on the left (by being formatted as number, not plain text), at the time you do the appendRow()
, you will be throwing the value not formatted to a formatted cell, which will receive the value already reduced.
Meanwhile, formatting as plain text for the sheet records column can be done either manually for the entire column, or before the if()
, not to execute the command for each new record.