2012-05-25 15 views
0

使用公式使用一段时间来寻找地址之间的距离作为函数来解决谷歌电子表格中50个导入xml限制。 - 导入xml字符串工作得很好,因为在谷歌文档中的公式,但我不断收到“未终止的字符串文字(第4行)”错误,当我调试时,我发现要清除的唯一方法是删除inner()。任何帮助或想法将不胜感激。Google文档脚本错误 - 未终止的字符串文字。 (第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; 
} 

回答

0

假设cd是变量,这整个事情是一个函数调用,尝试用+;,更换&。就像这样:

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

感谢您的帮助! – user1416395

相关问题