Google Sheet Color Scales

Google Apps Script Colour Scales v0.1 (13Dec13)

Color Scales Spreadsheet

STOP PRESS: Color Scale has now been released as an GSheet Add-on.

The Google Apps Script contained in this spreadsheet sets the background color of the cells in a selected range according to their numeric value. This is similar to the ‘color scales’ or color gradient feature in Microsoft Excel. The lowest number found in the selection is set to the low color, the highest value to the high color and every value in between is colored dependant on their position between the high and the low.

Get in touch now if you need any help with this or any other GAS scripts or have a look through some other free scripts and snippets.


Make your own copy and run it from there:

  • Follow the link to view a read-only copy of the spreadsheet.
  • Login with your own Google account (Sign-up top right-hand corner).
  • Make a copy of the spreadsheet (File>Make a copy…).
  • The copy will appear in the root of your Google Drive from where you can open it.
  • Select a range of numbers and click on Color Scale>Color Scale Selection.
  • To change the low and high colors click on Color Scale>Choose Colours and add your own colors as three decimal RGB values between 0 and 255.

Note: I know I’m British and I should be using “colour”, but for the international audience I’m using “color”. 🙂


Version 0.2

  • Added a dialog box to choose the colors rather than hard-coding them (they are now stored in UserProperties).
  • Added single call (setBackgrounds()) to set backgrounds plus other optimisations.

Version 0.1

  • First Version.

If you find any of the free software on this site useful please make a contribution to support further development: