I have an array with three values, but when it sets values in the spreadsheet it prints the first value three times instead of printing all three of them.
This is what I want to happen:
Last Name | First Name | Middle Name |
---|---|---|
Jobs | Steve | Paul |
This is what happens:
Last Name | First Name | Middle Name |
---|---|---|
Jobs | Jobs | Jobs |
<code>function createApplicationForms() {
let applicantName = [];
for (i = 0; i <= 420; i++) {
clearTemplateSheet(); // Clears templatesheet before replacing with another entry
// Adds an entry to the array
applicantName.push([source[i].last_name, source[i].first_name, source[i].middle_name]);
// Set values to range
templateSheet.getRange(9, 2, 1, applicantName[i].length).setValue(applicantName);
</code>
<code>function createApplicationForms() {
let applicantName = [];
for (i = 0; i <= 420; i++) {
clearTemplateSheet(); // Clears templatesheet before replacing with another entry
// Adds an entry to the array
applicantName.push([source[i].last_name, source[i].first_name, source[i].middle_name]);
// Set values to range
templateSheet.getRange(9, 2, 1, applicantName[i].length).setValue(applicantName);
</code>
function createApplicationForms() {
let applicantName = [];
for (i = 0; i <= 420; i++) {
clearTemplateSheet(); // Clears templatesheet before replacing with another entry
// Adds an entry to the array
applicantName.push([source[i].last_name, source[i].first_name, source[i].middle_name]);
// Set values to range
templateSheet.getRange(9, 2, 1, applicantName[i].length).setValue(applicantName);
New contributor
Jederic Papa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.