Skip to content

Instantly share code, notes, and snippets.

@Cyclenerd
Created April 15, 2022 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cyclenerd/f84d4db9d00a8d68541d4c61bb2fb4ae to your computer and use it in GitHub Desktop.
Save Cyclenerd/f84d4db9d00a8d68541d4c61bb2fb4ae to your computer and use it in GitHub Desktop.
Google Clout - Workspace - Assisting Spreadsheet Automation
function update_table() {
const sourceSheetName = "Source";
const destinationSheetName = "Destination";
const ss = SpreadsheetApp.getActiveSpreadsheet();
const [src, dst] = [sourceSheetName, destinationSheetName].map(s => ss.getSheetByName(s));
// update the status column in the source table with the word ???
const setStatus = ['D2','D3','D6'];
src.getRangeList(setStatus).setValue("???"); // TODO: Add status word here
// add the current date to the Date column in the destination table
const date = new Date();
const setDate = ['A2','A3','A4'];
dst.getRangeList(setDate).setValue(date);
// copy the corresponding data1 column values to the corresponding column in the destination table
dst.getRangeList(['C2']).setValue('va5');
dst.getRangeList(['C3']).setValue('va1');
dst.getRangeList(['C4']).setValue('va2');
// copy the corresponding data2 column values to the corresponding column in the destination table
dst.getRangeList(['D2']).setValue('vb5');
dst.getRangeList(['D3']).setValue('vb1');
dst.getRangeList(['D4']).setValue('vb2');
// logging commands
console.info('Spreadsheet Automation ScriptID[%s]', ScriptApp.getScriptId());
console.info('Spreadsheet Automation Script sets values in destination sheet for columns [%s]', date.toString()+',id5,va5,vb5')
console.info('Spreadsheet Automation Script updates source status for columns [%s]', setStatus);
/*
2:59:45 PM Notice Execution started
2:59:47 PM Info Spreadsheet Automation ScriptID[ ...Script ID.. ]
2:59:47 PM Info Spreadsheet Automation Script sets values in destination sheet for columns [ ... ,id5,va5,vb5]
2:59:47 PM Info Spreadsheet Automation Script updates source status for columns [D2,D3,D6]
2:59:47 PM Notice Execution completed
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment