存取及修改現有的資料來源圖表。
請僅將這個類別用於連結至資料庫的資料。
方法
方法 | 傳回類型 | 簡短說明 |
---|---|---|
forceRefreshData() | DataSourceChart | 重新整理這個物件的資料,無論目前狀態為何。 |
getDataSource() | DataSource | 取得物件連結的資料來源。 |
getStatus() | DataExecutionStatus | 取得物件的資料執行狀態。 |
refreshData() | DataSourceChart | 重新整理物件資料。 |
waitForCompletion(timeoutInSeconds) | DataExecutionStatus | 等到目前的執行作業完成,在提供的秒數後逾時。 |
內容詳盡的說明文件
forceRefreshData()
重新整理這個物件的資料,無論目前狀態為何。詳情請參閱 refreshData()
。
如果資料來源類型未啟用,就會擲回例外狀況。使用 SpreadsheetApp#enable...Execution()
方法,即可針對特定資料來源類型啟用資料執行功能。
回攻員
DataSourceChart
:資料物件。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getDataSource()
取得物件連結的資料來源。
回攻員
DataSource
:資料來源。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getStatus()
取得物件的資料執行狀態。
回攻員
DataExecutionStatus
:資料執行狀態。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
refreshData()
重新整理物件資料。
如果目前處於 error
狀態,就會擲回例外狀況。請使用 DataSource#updateSpec()
來更新規格。此方法建議優先於 forceRefreshData()
,以免資料來源發生非預期的編輯作業。
如果資料來源類型未啟用,就會擲回例外狀況。使用 SpreadsheetApp#enable...Execution()
方法,即可針對特定資料來源類型啟用資料執行功能。
回攻員
DataSourceChart
:資料物件。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
waitForCompletion(timeoutInSeconds)
等到目前的執行作業完成,在指定的秒數過後逾時。如果執行作業在逾時後未完成,但不會取消資料執行,就會擲回例外狀況。
參數
名稱 | 類型 | 說明 |
---|---|---|
timeoutInSeconds | Integer | 等待資料執行的時間 (以秒為單位)。長度上限為 300 秒。 |
回攻員
DataExecutionStatus
:資料執行狀態。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets