qiita arrayPractice.js
const ThisSpread = SpreadsheetApp.getActiveSpreadsheet();
function createSheet(){
const name_list = createNameList();
Logger.log(name_list);
const TemplateSheet = ThisSpread.getSheetByName('template');
for (let name of name_list){
const create_sheet = TemplateSheet.copyTo(ThisSpread);
create_sheet.setName(name);
}
}
function createNameList() {
const name_list = [];
const NamesSheet = ThisSpread.getSheetByName('names');
for (row = 1; row <= 5; row ++){
name_list.push(NamesSheet.getRange(row, 1).getValue());
}
//Logger.log(name_list);
return name_list;
}