Tweaks on Google Calendar API

Job ID: 36286388

Budget: $10 – $30 USD

Hi.

I have a spreadsheet (https://docs.google.com/spreadsheets/d/1rccSa_53Jy6GZWDI-XqO1pGc7BUcMJwzA16nTKS10zw/edit?usp=sharing) that I want to integrate with Google Calendar and I already have a code that does that for me.

However, I need the code to be tweaked so that:
1. one of the columns allows me to set the events to ALL DAY on Google Calendar;
2. one of the columns allows me to set the frequency of the events (daily, annualy etc.);
3. the code updates the calendar, instead of creating new events each time I run the script.

BELOW IS THE CODE:

function create_Events(){

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Teste");
var last_row = sheet.getLastRow();
var data = sheet.getRange("A1:E" + last_row).getValues();
var cal = CalendarApp.getCalendarById("calendarname");
//Logger.log(data);

for(var i = 0;i< data.length;i++){
// index 0 = Nome do Evento
// index 1 = Data e hora iniciais
// index 2 = Data e hora finais
// index 3 = Descricao
// index 4 = Cor

var Events = cal.createEvent(data[i][0],
new Date(data[i][1]),
new Date(data[i][2]),
{description: data[i][3], colorID: data[i][4]});
//Logger.log('Event ID: ' + event.getId());

}
Logger.log("Eventos criados com sucesso");

}
Related categories: PHP Google APIs Google Apps Scripts