1

How can I individually step through a range of cells in Google Sheets? I have a range of several cells (eg. D2:D10) and need to step through each cell in the range to pass to a function. The function accepts only a range of one cell (eg. D5) and performs an offset to change the background of a nearby cell.

My thought was to parse through the range in a for loop and send each cell to the function, but I can't seem to find a way to index within a range to pull out a subset. What am I missing?

I don't care about the values in the cells, so creating an array out of the values does not help me.

Thanks!

0

1 Answer 1

2

Use the getCell(row, column) function - it returns a cell (1-based) relative to the range. You can combine it with getNumRows() and getNumColumns() to parse over the range.

https://developers.google.com/apps-script/reference/spreadsheet/range#getCell(Integer,Integer)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.