下面是我的代码......我正在做的是我正在创建一个资源日历,然后我在我的电子表格中计算与该 bt 关联的事件的数量我只想要它一次 bt 它的 gt 在每一列中打印...... ..其次假设我有两个不同的事件,我想单独计算它..怎么做?
function caltest3(){
var ss = SpreadsheetApp.openById("0ArPwl7-RVTW4dFVaa204X1dXTGtBS0pxR2RUR1E4dkE"); //get spreadsheet by id
SpreadsheetApp.setActiveSpreadsheet(ss); //get active spreadsheet
var cal=CalendarApp.getCalendarById("_qMPDrbdlAAEgLlc2wfBUw@bmsinfoline.com"); //get calendar by id
var sheet = SpreadsheetApp.getActiveSheet(); //get acive sheet
var d1 = new Date("January 1, 2013"); //get dates
var d2 = new Date("July 13, 2013");
var events = CalendarApp.getEvents(d1, d2);
for (var i=0;i<events.length;i++) {
var details=[[events[i].getLocation(), events.length]];
// var details = [[events.length]];
var row = i+1;
var range=sheet.getRange(row+1,1,1,2);
range.setValues(details);
Logger.log('Number of events: ' + events.length);
} }