Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

204
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda