Script works, after two records created, the post date is now one day early.

22 views
Skip to first unread message

cee ess

unread,
Nov 15, 2024, 4:27:05 PMNov 15
to Google Apps Script Community
function addEvents(){
  var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
 var lr = ss.getLastRow();
  var cal = CalendarApp.getCalendarById("m2smvunl3ul8u...@group.calendar.google.com");
 
  var data = ss.getRange("A1:C" + lr).getValues();

 
  for(var i = 0; i<data.length;i++){
     

     cal.createAllDayEvent(data[i][0], new Date(data[i][1]), {description:'PRO: ' + data[i][2]});
  //  console.log(data[i][1]);
  }  
}

In the past I have used
var data = ss.getRange("A1:C" + lr).getDisplayValues();

Thank you for your time

cee ess

unread,
Nov 15, 2024, 11:27:09 PMNov 15
to Google Apps Script Community
For example.  

01/01/2025  - is placed into my calendar correctly
01/15/2025 - is placed into my calendar correctly
02/15/2025 - is placed into as 02/14/2025
02/27/2025 - is placed into as 02/26/2025
Reply all
Reply to author
Forward
0 new messages