Tuesday, 15 June 2010

google apps script - How to enclose code snippet in a function -



google apps script - How to enclose code snippet in a function -

need help writing code.

i looking create spreadsheet 1 staff fellow member per sheet in 1 workbook. know start off with:

var ss = spreadsheetapp.getactivespreadsheet(); var templatesheet = ss.getsheetbyname('sales'); ss.insertsheet(1, {template: templatesheet});

i having problem starting , ending code. can write code , add together "joe doe" & "jane doe" placeholders? modifying on end.

if i'm understanding correctly:

function generatesheets() { var staff = ["john doe", "jane doe"]; var ss = spreadsheetapp.getactivespreadsheet(); var templatesheet = ss.getsheetbyname("sales"); (var = staff.length - 1; >= 0; i--) ss.insertsheet("sales " + staff[i], 1, {template: templatesheet}); }

google-apps-script google-spreadsheet

No comments:

Post a Comment