我無法從我的電子表格中的單元格獲取值。我在文檔中找到了getCell() - 方法,但它不起作用。它總是得到「範圍」而不是價值。 (這是一個整數btw。) 而我沒有找到一個setCell() - 方法! o.O值是小區B:1個 THX對於任何幫助!1 :)獲取並設置單元格的值不起作用
var API_KEY = "***",
PROFILE_ID = "****";
GET_PLUS_ONES_URI = "https://www.googleapis.com/plus/v1/people/"+PROFILE_ID+"?fields=plusOneCount&key="+API_KEY;
var currentPlusOnes = 0,
lastPlusOnes = 0,
ss = SpreadsheetApp.getActive();
function execute() {
getCurrentPlusOnes();
getLastPlusOnes();
if (currentPlusOnes !== getLastPlusOnes) {
setCurrentValue();
}
}
function getCurrentPlusOnes() {
currentPlusOnes = JSON.parse(UrlFetchApp.fetch(GET_PLUS_ONES_URI)).plusOneCount;
}
function getLastPlusOnes() {
lastPlusOnes = ss.getRange("B1").getCell(1, 1); // --> Allways just "Range" instead of the value
}
function setCurrentValue() {
ss.getDataRange().setValue(currentPlusOnes);
}
lastPlusOnes = ss.getRange( 「B1」)的getValue(); – ScampMichael