Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function BGFunction() {
- var I_INDEX = 1;
- var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Jul 14");
- var dataRange = sheet.getDataRange();
- var dataValues = dataRange.getValues();
- for (var i=29; i<=dataRange.getNumRows(); i++) {
- var row = sheet.getRange(i, 1, 1, 7);
- if (dataValues[i-1][I_INDEX-1] != '') {
- //sheet.getRange('D31').setValue(dataValues[i-1][I_INDEX-1]);
- row.setBackground("#DEF7A7");
- }
- else
- row.setBackground("#fff");
- }
- }
- function onEdit(event) {
- BGFunction();
- }
- /**
- * Retrieves all the rows in the active spreadsheet that contain data and logs the
- * values for each row.
- * For more information on using the Spreadsheet API, see
- * https://developers.google.com/apps-script/service_spreadsheet
- */
- function readRows() {
- var sheet = SpreadsheetApp.getActiveSheet();
- var rows = sheet.getDataRange();
- var numRows = rows.getNumRows();
- var values = rows.getValues();
- for (var i = 0; i <= numRows - 1; i++) {
- var row = values[i];
- Logger.log(row);
- }
- };
- /**
- * Adds a custom menu to the active spreadsheet, containing a single menu item
- * for invoking the readRows() function specified above.
- * The onOpen() function, when defined, is automatically invoked whenever the
- * spreadsheet is opened.
- * For more information on using the Spreadsheet API, see
- * https://developers.google.com/apps-script/service_spreadsheet
- */
- function onOpen() {
- var sheet = SpreadsheetApp.getActiveSpreadsheet();
- var entries = [{
- name : "Read Data",
- functionName : "readRows"
- }];
- sheet.addMenu("Script Center Menu", entries);
- };
Add Comment
Please, Sign In to add comment