Kenci
Kenci

Reputation: 4882

How do i execute a function when text changes in a cell? (google docs)

I've been lookin for a function to change the color of all cells in a row, when some text in a certain cell equals something. I found it here:

Google Spreadsheet: Script to Change Row Color when a cell changes text;

My question is, how can i execute this function, when the text changes?

Upvotes: 8

Views: 29804

Answers (2)

pnuts
pnuts

Reputation: 59495

Given when some text in a certain cell equals something Conditional Formatting may be much simpler. onEdit would be required if the change is from 'any value' to 'any other value' (so potentially from y to x as well from x to y) but CF can be triggered in cases such as:

"from less than 100 to 100 (or to 100 or more than 100), etc.",
"from Pending to Complete (or to any member of a list such as Abandoned, Transferred, Rescheduled, etc.)",
"from more than a year left to less than a month (or a week, or 4 days, etc.)",
"from any one of Red, Orange, Yellow to Green or Blue (or either Indigo or Violet, etc.),
"from being a unique entry in a list to being a duplicate (ie without changing its own value becomes equal to any other entry)

Upvotes: 3

Gabriel
Gabriel

Reputation: 146

Search for the function onEdit. https://developers.google.com/apps-script/guide_events

Upvotes: 13

Related Questions