Created
April 15, 2022 19:26
-
-
Save Cyclenerd/f84d4db9d00a8d68541d4c61bb2fb4ae to your computer and use it in GitHub Desktop.
Google Clout - Workspace - Assisting Spreadsheet Automation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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