Skip to content

Instantly share code, notes, and snippets.

@supernovaplus
Last active June 20, 2019 19:29
Show Gist options
  • Save supernovaplus/d247bb95768e337fa5db645212d8d988 to your computer and use it in GitHub Desktop.
Save supernovaplus/d247bb95768e337fa5db645212d8d988 to your computer and use it in GitHub Desktop.
function companyBankVouchersMove() {
var initialScanLocation = 69;
var spreadsheet = SpreadsheetApp.openById("-");
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Company Bank'), true);
var column = spreadsheet.getRange('D'+initialScanLocation+':D');
var values = column.getValues(); // get all data in one call
var location = 0;
while ( values[location][0] != "" ) {
location++;
}
location = location+initialScanLocation;
var time = new Date().toLocaleString('lt');
var elm1 = spreadsheet.getRange("D" + ( location-1 ) + ":D" + location);
elm1.setValues([[elm1.getValues()[0][0]],["=Vouchers!$G$3"]]);
elm1.setNote("script touched this elm1 on "+time);
var elm2 = spreadsheet.getRange("G" + ( location-1 ) + ":G" + location);
elm2.setValues([[elm2.getValues()[0][0]],["=Vouchers!$P$3"]]);
elm2.setNote("script touched this elm2 on "+time);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment