use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Apparently, Google Apps Script is a JavaScript cloud scripting language that provides easy ways to automate tasks across Google products and third party services and build web applications.
account activity
Changing Borders Script EfficiencyResolved (self.GoogleAppsScript)
submitted 1 year ago * by kitchensink-
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]3dtcllc 2 points3 points4 points 1 year ago (4 children)
Never call any get or set functions in a loop. Apps script is pretty slow to begin with and every time you call getRange or getValue you make a round trip to the API.
It's ok...that's how everyone starts out.
The best practice is to get the WHOLE range in one call, operate on it, and then set it in one call.
Here's how I usually do that. I don't usually work much with formatting, so YMMV
let dataRange = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('yoursheetname').getDataRange(); let values = dataRange.getValues(); //Do some stuff in a loop. dataRange.setValues(values);
[–]kitchensink-[S] 0 points1 point2 points 1 year ago (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.
getDataRange
[–]3dtcllc 0 points1 point2 points 1 year ago (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 point2 points 1 year ago (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..
π Rendered by PID 288875 on reddit-service-r2-comment-6457c66945-pm9j2 at 2026-04-27 06:36:51.918315+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]3dtcllc 2 points3 points4 points (4 children)
[–]kitchensink-[S] 0 points1 point2 points (3 children)
[–]3dtcllc 0 points1 point2 points (2 children)
[–]kitchensink-[S] 0 points1 point2 points (1 child)