Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Improve script performance

$
0
0

I wanted to ask, if I can do anymore improvements regarding my runtime, currently it takes roughly 100s to finish my script(since adding the formatting script below). Before adding additional formatting, it took roughly 4-5 seconds to run all my code.

The script checks every cell in a given range, if it has a data validation linked to it and based on that to format the cell.

for(let i = 9; i < 32;i++){for(let j = 2; j < 13; j++){  cell = sheet.getRange(i,j)  cellDataValCheck = sheet.getRange(i,j).getDataValidation()  if(cellDataValCheck != null){    cell    .setBorder(true, true, true, true, false, false, "black", SpreadsheetApp.BorderStyle.SOLID)    .setBackground("#FFFFFF")    .setHorizontalAlignment("center")  }else{    cell.setBackground("#666666")  }}

Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>