Google-sheets – Function to retrieve a subset of rows coming from another function in Google Sheets

google docsgoogle sheets

I have a function in a Google Sheet that returns a handful of columns and two rows. One of those rows contains column headings, which I would like to remove.

Google Sheet

Is there any way to wrap this function with another function so that I can keep only row 2, which has the data I need?

Best Answer

As suggested in the comments, you can use the INDEX formula for that. Leaving the third parameter blank, allows for a complete row to be shown:

 INDEX(reference, [row], [column])

 INDEX(callService("geocodingServices"), 2)

I couldn't help thinking about the geocodingService you use. This is also possible from within Google Apps Script. First I had to retrieve an address from the data you provided in you question:

Code

function getReverse(lat, lng) {
  var response = Maps.newGeocoder().reverseGeocode(lat, lng);
  var result = response.results[0];
  return result.formatted_address;
}

Based on this address I was able to obtain the lat. and lng.:

function getGeo(address) {
  var response = Maps.newGeocoder().geocode(address);
  var result = response.results[0];
  return [[result.geometry.location.lat, result.geometry.location.lng]];
}

Screenshot

enter image description here

Example

I've created an example file for you: geocodingService