Google Docs Script to transfer data from a questionnaire to a new document? -
this question google docs scripting document.
i create script that, when run it, transfer 1 row of data questionnaire (that choose before running script) new google docs word document.
is possible, , if how it?
shouldn't difficult - tricky bit comes want data in new doc. example script be:
function sendtonewsheet() { var sheet = spreadsheetapp.getactivesheet(); var row = sheet.getactiverange().getrowindex(); var range = sheet.getrange(row,1,1,sheet.getlastcolumn()).getvalues(); var doc = documentapp.create(new date().gettime()); doc.appendparagraph(range.join()); doc.saveandclose(); } function onopen() { var submenus = [{name:"send new sheet", functionname: "sendtonewsheet"}]; spreadsheetapp.getactivespreadsheet().addmenu("help desk menu", submenus); }
with that, can select cell in spreadsheet , use menu execute function take data in cell's row, create new document, , add data document. if wanted name document based on data, do:
var doc = documentapp.create(range[0][1]);
which use data in second column. document created in top level directory can move after it's created specific folder want.
Comments
Post a Comment