且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Google脚本/将执行时间减少到执行时间限制以下

更新时间:2021-09-02 21:41:02

我在这部分代码中看到了问题:

I see the problem in this part of code:

do { 
  // read info from the sheet
  range.getValue();
  // more code here...

} // only do while x = max number of suppliers reached
  while (y<x)

操作getValue需要很多时间才能运行.***做法是使用整个范围:

Operation getValue takes much time to run. Best practice is to use the whole range:

var data = sheet.getDataRange().getValuses();

,然后将数据用作进一步计算的来源.

and then use data as source for further calculations.

在此处查看更多信息:

https://developers.google.com/apps-script/best_practices