Skip to content

Instantly share code, notes, and snippets.

@zackbatist
Created February 17, 2019 18:59
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 zackbatist/bf52b0810e5135d4ba01d4d6e9a74b04 to your computer and use it in GitHub Desktop.
Save zackbatist/bf52b0810e5135d4ba01d4d6e9a74b04 to your computer and use it in GitHub Desktop.
Google Sheets function that returns the hex code for the background colour of a cell
/**
* getHex.gs
* =getHex(cell("address",A1)) returns hex code for background colour of cell A1
* taken from https://stackoverflow.com/questions/28962526/google-spreadsheets-sort-filter-by-background-fill
*/
function getHex(input) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var cell = ss.getRange(input);
var result = cell.getBackground();
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment