我的查询太慢了。这需要一分多钟。如何快速创建查询? 你能救我吗?
function onOpen() {
var menu = [{name: "Jump to today's date", functionName: "jumpToDate"}];
SpreadsheetApp.getActiveSpreadsheet().addMenu("Custom", menu);
jumpToDate();
}
function jumpToDate() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var range = sheet.getRange("C:C");
var values = range.getValues();
var day = 24*3600*1000;
var today = parseInt((new Date().setHours(0,0,0,0))/day);
var ssdate;
for (var i=0; i<values.length; i++) {
try {
ssdate = values[i][0].getTime()/day;
}
catch(e) {
}
if (ssdate && Math.floor(ssdate) == today) {
sheet.setActiveRange(range.offset(i,0,1,1));
break;
}
}
}