Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

327
Vistas
Google Calendar API - getEvents everyday and only certain events with time frames

I am trying to write a script that I can click a custom menu button and it will pull all the events scheduled on my calendar within the hours of (9:00 AM - 11:00 AM , 12:00 PM - 1:00 PM , 3:00 PM to 5:00 PM). Right now it runs by grabbing everything on my calendar for the day (including lunch) and internal meetings but I only need the events that are scheduled within the specific hours.

Also is it possible to only pull certain things from the description of a google event? For ex, the getDescription will get everything included and most of it is not needed, though there is a linkedin profile URL in the description that i do need. How can I set it so it gets the description and only retains the items I want? Here is the script I am running in App Script with the Calendar API.

function getEvents(){

  var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var cal = CalendarApp.getCalendarById("ID");
  var today = new Date();
  var dd = today.getDate();
  var mm = today.getMonth(); //January is 0!
  var yyyy = today.getFullYear();
  var hh = 

  var events = cal.getEvents(new Date(yyyy, mm, dd, 0, 0, 0), new Date(yyyy, mm, dd, 23, 0, 0));

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

   var title= events[i].getTitle();
   var sd = events[i].getStartTime();
   var loc = events[i].getLocation();
   var des = events[i].getDescription();
   var email = events[i].getGuestList().map(function(x) {return x.getEmail();}).join(',')
  
   ss.getRange(i+2, 2).setValue(title);
   ss.getRange(i+2, 8).setValue(loc);
   ss.getRange(i+2, 9).setValue(des); 
   ss.getRange(i+2, 9).trimWhitespace();
   ss.getRange(i+2, 1).setValue(sd);
   ss.getRange(i+2, 1).setNumberFormat("mm/dd/yyyy");
   ss.getRange(i+2, 7).setValue(email);
  }
 }


function addCandidates()  {

  let ui = SpreadsheetApp.getUi();
  ui.createMenu('Run Code').addItem('Add New Candidates','getEvents').addToUi();



}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda