I am using Google Spreadsheets and I am trying to do the following:
How can I get a range of cells (R2:V2) to match the background color of D2 when I change the color of cell D2.
For example: If I change the background color of D2 to red. I want cells R2 through V2 to format to the same color red.
If I change the background color of D3 to green. I want cells R3 through V3 to format to the same color green.
The short answer is you can't.
The long answer:
If you take a look at the Google Apps Script documentation for custom functions, you will see a list of all the functions that you can do.
The problem is you can only set the value, not the color of the cell. You will get a permission denied.
To show you this, look at the following script:
By theory, it should work, however the scripting doesn't support it.
When running in google-sheets you get the following:
According to their documentation they say this:
Reference: https://developers.google.com/apps-script/guides/sheets/functions