ObjApp是否会使应用程序脚本变慢? [英] Does the ObjApp makes the app script slower?
问题描述
我的应用程序脚本页面加载时间更长一些.我使用了以下功能.我想知道,库对象函数是否会使应用程序脚本页面的加载时间更长.如果是这样的话.我该如何改善我的代码?
My app script page loading time is a bit longer. I used the following functions. I am wondering, if the library object function makes the app script page loading time longer. If that is the case. how can I improve my code?
function getData() {
var ss=SpreadsheetApp.openById('');
var sheet=ss.getSheetByName('attendance');
return sheet;
}
function dataresult() {
var sheet = getData();
var data = ObjApp.rangeToObjects(sheet.getDataRange().getValues());
return data;
}
Function sample() {
for(var i=0 ; i< data.length;i++){
var date= data[i].dateattend;
}
}
就我不使用库的加载时间而言,您认为此功能比上一个功能好吗?
Do you think this function is better than the previous one in terms of loading time where I didn't use library?
function sample() {
var sheet = SpreadsheetApp.getActiveSheet();
var data = sheet.getDataRange().getValues();
for (var i = 0; i < data.length; i++) {
var date= data[i][0]);
}
}
推荐答案
是的,使用库会使脚本比不使用库慢,实际上,由于这种情况,Google不允许在附加组件上使用库
Yes, using a library makes a script slower than non using the library, actually, Google doesn't allow the use of libraries on add-ons because of this.
https://developers.google.com/apps-script/guide_libraries
这篇关于ObjApp是否会使应用程序脚本变慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!