I’m trying to pull data from a Google Sheet using Apps Script. There’s a column with Place smart chips that show Google Maps locations. When I use getValues() or getDisplayValues(), I only get the place name as text. But I need both the name and the Maps link for each location.
I’ve tried:
function getPlaceData() {
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getRange('A1:A10');
var values = range.getValues();
var displayValues = range.getDisplayValues();
var richTextValues = range.getRichTextValues();
Logger.log(values);
Logger.log(displayValues);
Logger.log(richTextValues);
}
None of these methods give me the URL. Is there a way to grab both the place name and its Google Maps link from these smart chip cells? Any help would be great!
I’ve encountered a similar issue when working with Place smart chips in Google Sheets. Unfortunately, there’s no straightforward method to extract both the place name and the URL using the standard Apps Script functions. A possible workaround involves enabling the Maps Service in your project, which allows querying the Places API by the place name. This way you can retrieve additional details, extract the place ID, and construct the Maps URL. Note that this approach requires an extra API call and careful management of usage limits, especially with larger datasets.
hey there! i’ve run into this too. sadly, there’s no easy way to get both name+url from those smart chips. one hacky workaround is to use the HYPERLINK function in a nearby cell to manually create clickable links. not ideal, but it works. hope that helps a bit!
I’ve encountered similar challenges before. In my experience, the solution was to use the Maps Service combined with the Places API. First, enable the Maps Service in your Apps Script project. Then, query the Places API using the location name to retrieve detailed information including the place ID. Once you have the place ID, you can construct the proper Maps URL. This method requires additional API calls and careful management of usage limits, especially with larger datasets, but it has proven to be effective. I’m happy to provide more details if needed.