Reputation: 683
The purpose of the script is to import data form the google spreadsheet into the google calender.
function caltest1() {
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 11; // First row of data to process
var numRows = 4; // Number of rows to process
var dataRange = sheet.getRange(startRow, 1, numRows, 5);
var data = dataRange.getValues();
var cal = CalendarApp.getDefaultCalendar();
for (i in data) {
var row = data[i];
var title = row[0]; // First column
var desc = row[1]; // Second column
var tstart = row[5];
var tstop = row[6];
var loc = row[7];
//cal.createEvent(title, new Date("March 3, 2010 08:00:00"), new Date("March 3, 2010 09:00:00"), {description:desc,location:loc});
cal.createEvent(title, tstart, tstop, {description:desc,location:loc});
}
}
the values of column 5 and 6 are;
2-3-2013 17:00:00 2-3-2013 18:00:00
When launch the debug tool - i get the message tstart = undefined and tstop = undefined
When i remove the time value it works fine...but i want also time values in my calender...How can i fix this?
Thanks..remco
Upvotes: 0
Views: 563
Reputation: 46802
You are defining dataRange
as an array of 5 columns so you can't have values > 4 (0 indexed).
Simply increase the size of your dataRange
to at least 8 columns
Upvotes: 1