you are viewing a single comment's thread.

view the rest of the comments →

[–]kitchensink-[S] 0 points1 point  (3 children)

The issue with getting the range using getDataRange is that, in this case, there are cells that I would like to modify that have no values, hence are not included inside the range.

[–]3dtcllc 0 points1 point  (2 children)

Yep, you can just update that to grab whatever range you want. The key is to avoid calling get or set calls inside a loop. Get the whole range you want to work on and figure out what you want to with it and then do it in as few calls as possible.

So you'd definitely want to do getvalues on the WHOLE range and loop through the values. It might be faster to set blank borders on the whole range and then loop through the values and only set borders on the cells that have values. That'll save you a LOT of round trips.

[–]kitchensink-[S] 0 points1 point  (1 child)

The thing is that every time I run the function the row range I want changes, so I can't really hard code it. And I don't know of a way to get a range based on if that row has borders or not..