Pages

Friday, 21 December 2018

Check cell colour and loop

The following Google Apps Script code is part of a larger project detailed in a later post (here). It is designed to get the background colour of a cell which can be later used to determine if the rest of the function has already been run for a user - by colouring it when it has. I developed the function for a technician rota where it was highly likely there would be a change in staffing at some point and so I could clear the cell colour and re-run it without emailing everybody.

In this example once the script has acquired data from the sheet it creates a loop to go through each assignee. During the loop it gets the assignee cell ('getCell') first, which then allows for 'getBackground' to check the cell colour is white. If true, it then picks up the corresponding 'room number'. A menu item is created on-open to easily run the function.

Check Cell Colour and Loop.xlsx

No comments:

Post a comment