2012-05-25 40 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

相關問題