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

205
Vistas
How can Google JavaScript API's geometry library be used on Google Apps Script for Google Sheets?

I have a KML with a list of point coordinates of stores with values attached (e.g. weekly revenue). The KML links for every weeks are in a Google Sheet. Each week a new line is added to the Google Sheets with the corresponding weekly data. I have another KML with a polygon - sort of target area. I wanted to run stats on the stores located inside the target area polygon (number of stores, average revenue, etc.) on a weekly basis. I wanted to output those stats on a Google Sheet that I could share for other people to add other data on the stores by hand, and to be able to use the file in the G Suite. Then I wanted all this to update automatically when a new set of weekly data KML is published. I thought I could maybe run all this on Google Apps Script to stay as close as possible to Google Sheets (the way one would do on VBA for Excel). I saw that Google JavaScript API’s geometry library had the containsLocation() function that could help me perform operations on the points within my polygon.

**

  • Is it possible to use Google JavaScript API’s geometry library on Google Apps Script ?
  • Is this the easiest way to perform what I intend to do?

**

I tried things like this:

    function belongsArea(store, areaCoords) {
  
  var store
  var areaCoords

  var url = 'https://maps.googleapis.com/maps/api/js?key=MY_API_KEY&callback=belongsFacility';
  var response = UrlFetchApp.fetch(url,  {'muteHttpExceptions': true});
  
  Logger.log(response)

  const areaScope = new google.maps.Polygon({ paths: areaCoords });

  return google.maps.geometry.poly.containsLocation(store,areaScope)

}

The thing is that I’m not very familiar with JavaScript.

The first issue I encounter is that I always get ReferenceError: google is not defined and I don’t see how to call the API.

Many thanks for your help

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