Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

213
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!