0

正在使用我已经使用了一段时间的公式来查找地址之间的距离作为函数来绕过谷歌电子表格中的 50 个导入 xml 限制。- 导入 xml 字符串作为谷歌文档中的公式工作得很好,但是我在调​​试时不断收到“未终止的字符串文字。(第 4 行)”错误,我发现清除它的唯一方法是删除之间的所有内容内部 () 。任何帮助或想法将不胜感激。

function findkm(c) { 
  var y = 0;

  y = INDEX(SORT(ImportXML("http://maps.google.com/maps/api/directions/xmlorigin="&c&"&destination="&d&"&sensor=false&units=metric";"//distance");1;FALSE);1;2);
  return y;
}
4

1 回答 1

0

假设candd是变量并且这整个事情是一个函数调用,尝试&+;替换,。像这样的东西:

y = INDEX(SORT(ImportXML("http://maps.google.com/maps/api/directions/xmlorigin="+c+"&destination="+d+"&sensor=false&units=metric","distance"),1,FALSE),1,2);
于 2012-05-25T02:12:35.037 回答