1

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?

  • Have you tried the INDEX() formula? – Jacob Jan Tuinstra Dec 11 '14 at 16:01
  • Why don't you share a doc. This way perhaps I can alter the code.... – Jacob Jan Tuinstra Dec 11 '14 at 16:03
  • @JacobJanTuinstra INDEX() works great!! INDEX(callService("geocodingServices"), 2). Please post that as an answer so that I may accept it. I cannot share the document as my function returning data is script driven and tied to some internal APIs. – Brad Dec 11 '14 at 17:01
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.