I currently have two google sheets.
- 1 is a master sheet in which each row contains information specific to an individual student.
- The other is a template that I hope to make a copy of and then populate with information from a specific row of the master sheet (so each student will have their own googlsheet with only their information in it.
The issue I'm having is that I can't figure out how to import an entire row all at once.
My initial attempt was based off of this idea. However, since I am trying to import roughly 1000 different cells (yes all in the same row) the script times out before completing the script for 60 students. I assume it will be faster to import an entire row instead of using "createTextFinder" to replace all 1000 references. I've also read that using a trigger may be a work around to the script timing out - but I also couldn't figure that out (yet). I'd be happy using either solution. The part of the code I believe you need to reference is below. And this is a copy of my master sheet. [update] This is a copy of the template sheet (note that I made a copy so the sheet ID won't match the code).
// Loop over the rows
data.forEach((row,i) => {
// Identify whether notification has been sent
if (row[936] === 'send') {
//Enter collected info into Requirements Template
const googleSheetTemplate = DriveApp.getFileById('1DZZVZ5y1r5RmP4dMYmZuBQWPzIPp6eVZsdUrrador3o');
const destinationFolder = DriveApp.getFolderById('10px5WeNyVa9jSNQjCKV9jwcacCDvpByp');
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data');
const copy = googleSheetTemplate.makeCopy(`${row[1]}, ${row[2]}, ${row[938]} Report Card` , destinationFolder);
const newSheet = SpreadsheetApp.openById(copy.getId());
const A1 = newSheet.getDataRange();
for (currentsheet = 0; currentsheet < newSheet.getSheets().length; currentsheet++) {
const a1 = newSheet.getSheets()[currentsheet].getDataRange();
A1.createTextFinder("{{StudentEmail}}").replaceAllWith(row[0]);
A1.createTextFinder("{{FirstName}}").replaceAllWith(row[1]);
A1.createTextFinder("{{LastName}}").replaceAllWith(row[2]);
The issue I'm having is that I can't figure out how to import an entire row all at once., can you provide the sample Spreadsheet ofgoogleSheetTemplateas an image? And, in your situation, your script works fine. But you want to reduce the process cost of your script. Is my understanding correct?