Tomáš Kapler
Tomáš Kapler

Reputation: 439

how to get value of cell passed as function parameter in Google Spreadsheets?

I need to create function, which should have 2 parameters - cells and this function should then take the value of those defined cells and use it for some other function. This is what i got.

function getAddress(latitude,longitude) {

  var latitude = latitude.getValue();
  var longitude = longitude.getValue();
  var result = Maps.newGeocoder().reverseGeocode(latitude, longitude);
    var addresses = result.results[0].address_components;
  var resultText = "";

  for (var i = 0; i < addresses.length; i++){
    resultText = resultText + addresses[i].long_name + "\n\r";
  }

Prolem is, that it does not work. If I do e.g.

function getAddress() {

  var latitude = 49.841414;
  var longitude = 18.290973;
  var result = Maps.newGeocoder().reverseGeocode(latitude, longitude);
    var addresses = result.results[0].address_components;
  var resultText = "";

  for (var i = 0; i < addresses.length; i++){
    resultText = resultText + addresses[i].long_name + "\n\r";
  }

it works as a charm (just returning values in wrong encoding, what is my second problem)

pretty please? i'm fighting with it for 3 hours, tried tons of other ways i have googled but nothing has worked.

Upvotes: 0

Views: 320

Answers (1)

Tom&#225;š Kapler
Tom&#225;š Kapler

Reputation: 439

So actualy it works. Problem is, that Google is ... - I have czech settings for spreadsheets and in czech settings this =someFunction(a,b) does not work, you must use semicolon =someFunction(a;b) AAAARGH :-(

Upvotes: 1

Related Questions