2016-06-30 4 views
-1

Zillow의 데이터를 Google 문서로 가져 오는 스크립트가 있습니다 .... 아래를 참조하십시오. 2 년 동안 제대로 작동했지만 최근에는 업무가 중단되었습니다. 실행하는 데 시간이 오래 걸리며 데이터가 채워지지 않습니다. Zillow ID는 활성 시트의 B 열에 있으며 스크립트에 따라 Zestimate는 48 열에 기입해야합니다. ZWS-ID를 "X1-XXXXXXXXX_XXXX"로 바꿉니다.Zillow 및 Google Script

모든 도움을 주시면 대단히 감사하겠습니다.

감사 KIWI가 작동하고

function getZillowEstimates() { 
    var sheet = SpreadsheetApp.getActiveSheet(); 
    var rows = sheet.getDataRange(); 
    var numRows = rows.getNumRows(); 
    var values = rows.getValues(); 

    var specificRow = "" 
    var endRow; 
    if(specificRow == "") 
    { 
    specificRow = 1; 
    endRow = numRows; 
    } 
    else 
    { 
    specificRow = specificRow - 1; 
    endRow = specificRow; 
    } 
    for (var i = specificRow; i <= endRow; i++) 
    { 
    try 
    { 
     var row = values[i]; 
     var response = UrlFetchApp.fetch("http://www.zillow.com/webservice/GetZestimate.htm?zws-id=X1-XXXXXXXXX_XXXX&zpid=" + row[1]); 
     var xmlDoc = XmlService.parse(response.getContentText()); 
     var documentElement = xmlDoc.getRootElement(); 
     var destinationRange = sheet.getRange(i + 1, 48, 1, 1); 
     if(null != documentElement) 
     { 
     var responseElement = documentElement.getChild("response"); 
     if (null != responseElement) 
     { 
      var zestimateElement = responseElement.getChild("zestimate"); 
      if(null != zestimateElement) 
      { 
      var amountElement = zestimateElement.getChild("amount"); 
      if(null != amountElement) 
      { 
       var rowValue = []; 
       var cellValue = []; 
       cellValue.push(amountElement.getText()); 
      } 
      } 
     } 
     } 
     else 
     { 
     cellValue.push("Not Found"); 
     } 
     rowValue.push(cellValue); 
     destinationRange.setValues(rowValue); 
    } 
    catch(exception) 
    { 

    } 
    } 
}; 



/** 
* Adds a custom menu to the active spreadsheet, containing a single menu item 
* for invoking the readRows() function specified above. 
* The onOpen() function, when defined, is automatically invoked whenever the 
* spreadsheet is opened. 
* For more information on using the Spreadsheet API, see 
* https://developers.google.com/apps-script/service_spreadsheet 
*/ 
function onOpen() { 
    var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); 
    var menuItems = [ 
    {name: 'Get ZEstimate', functionName: 'getZillowEstimates'}, 
    ]; 
    spreadsheet.addMenu('Zestimates', menuItems) 
}; 
+0

[so]에 오신 것을 환영합니다. [둘러보기]와 체크 아웃 [질문]을 가져 가십시오. –

답변

0

오늘. 어제 스크립트는 6 분, 오늘은 1.6 초 걸렸다. 저는 Zillow 나 API에 문제가 있다고 생각합니다.