2016-07-07 2 views
0

데이터 푸시를 mysql 테이블에서 Google 시트로 분할하는 방법.mysql에서 Google 시트로 데이터 가져 오기

for (var i = 0; i < 1; i++) { 
    while (result.next()) { 
    var rowData = []; 
    for (var column = 0; column < result.getMetaData().getColumnCount(); column++) { 
     rowData.push(result.getString(column + 1)); 
    } 
    data.push(rowData); 
    } 
    sheet.getRange(sheet.getLastRow() + 1, 1, data.length, data[0].length).setValues(data); 
} 

인가가 난 2500 개 기록에서 푸시를 중단하고 트리거가 2501에서 그것을 선택하고 모든 테이블 데이터 시트를 누를 때까지 등등 5000에서 휴식과 가질 수있는 방법.

답변

1

특성 서비스 (https://developers.google.com/apps-script/reference/properties/)를 사용하여 반복 계수를 저장 한 다음 트리거에서 실행할 때 스크립트에서 참조하도록하십시오.

속성은 문자열로 저장되므로 계산을 수행하려면 숫자로 변환해야합니다.

//On script exit write the iteration count 
var scriptProperties = PropertiesService.getScriptProperties(); 
scriptProperties.setProperty('myCount', i); 

//when the script runs get the latest iteration count, and start at next 
var scriptProperties = PropertiesService.getScriptProperties(); 
var startNUmber = scriptProperties.getProperty('myCount').parseInt() + 1; 
관련 문제