javascript - How To Use an Apps Script To "Copy-PasteValue" Dynamic Data In a Google Spreadsheet at a given time? -
i have google spreadsheet imports , modifies data online source updates every hour. wish pull static copy of 10pm update spreadsheet—essentially copy-paste special @ time. using following script , set time-driven trigger 10pm. script pulls data cells n5:n10 of 1 sheet (which update every hour) , pastes static values cells n5:n10 of second sheet in same spreadsheet.
function pastevalue()}
var ss = spreadsheetapp.getactivespreadsheet();
var data= ss.getsheets()[1].getrange("n5:o10").getvalues();
ss.getsheets()[2].getrange("n5:o10").setvalues(data);
}
when run script manually works perfectly. however, when set time-driven trigger , close sheet, imported series of static “#######” when check next morning.
does have insight problem? or, if has alternative script or method automatically copy-pastevalues in google spreadsheets using formulas or scripts, appreciate it.
thanks, ron
when using triggers openbyid instead of getactive
function pastevalue()} var ss = spreadsheetapp.openbyid(id); ss.getsheets()[1].getrange("n5:o10").copyto(ss.getsheets()[2].getrange("n5"),{contentsonly:true}); }
Comments
Post a Comment