代表試算表格線上的圖片。
方法
內容詳盡的說明文件
assignScript(functionName)
將具有指定函式名稱的函式指派給這個圖片。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
function | String | 指定的函式名稱。這必須是公開頂層函式,不得為以底線結尾的函式,例如 private。 |
回攻員
OverGridImage - 這個圖片,用於鏈結。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
getAltTextDescription()
傳回這張圖片的替代文字說明。
回攻員
String:替代文字說明。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
getAltTextTitle()
傳回這張圖片的替代文字標題。
回攻員
String:替代文字標題。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
getAnchorCell()
getAnchorCellXOffset()
傳回錨定儲存格的水平像素偏移量。
回攻員
Integer:水平像素偏移。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
getAnchorCellYOffset()
傳回錨定儲存格的垂直像素偏移量。
回攻員
Integer:垂直像素偏移。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
getHeight()
以像素為單位傳回這張圖片的實際高度。
// Logs the height of all images in a spreadsheet const images = SpreadsheetApp.getActiveSpreadsheet().getImages(); for (let i = 0; i < images.length; i++) { Logger.log(images[i].getHeight()); }
回攻員
Integer:圖片的高度 (以像素為單位)。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
getInherentHeight()
以像素為單位傳回這張圖片的固有高度。
回攻員
Integer:以像素為單位的固有高度。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
getInherentWidth()
以像素為單位傳回這張圖片的固有高度。
回攻員
Integer:以像素為單位的固有寬度。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
getScript()
傳回指派給這張圖片的函式名稱。
回攻員
String:函式名稱。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
getSheet()
傳回顯示這張圖片的工作表。
// Logs the parent sheet of all images in a spreadsheet const images = SpreadsheetApp.getActiveSpreadsheet().getImages(); for (let i = 0; i < images.length; i++) { Logger.log(images[i].getSheet()); }
回攻員
Sheet:圖片所在的試算表。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
getWidth()
以像素為單位傳回這張圖片的實際寬度。
// Logs the width of all images in a spreadsheet const images = SpreadsheetApp.getActiveSpreadsheet().getImages(); for (let i = 0; i < images.length; i++) { Logger.log(images[i].getWidth()); }
回攻員
Integer:圖片寬度 (以像素為單位)。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
remove()
從試算表刪除這張圖片。對圖片執行任何進一步作業都會導致指令碼錯誤。
// Deletes all images in a spreadsheet const images = SpreadsheetApp.getActiveSpreadsheet().getImages(); for (let i = 0; i < images.length; i++) { images[i].remove(); }
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
replace(blob)
並以提供的 BlobSource 指定的圖片取代。支援的 blob 大小上限為 2 MB。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
blob | Blob | 以 Blob 形式呈現的新圖片。 |
回攻員
OverGridImage - 這個圖片,用於鏈結。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
replace(url)
將這張圖片換成指定網址的圖片。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
url | String | 新圖片的網址。 |
回攻員
OverGridImage - 這個圖片,用於鏈結。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
resetSize()
將圖片重設為原始尺寸。
回攻員
OverGridImage - 這個圖片,用於鏈結。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
setAltTextDescription(description)
設定這張圖片的替代文字說明。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
description | String | 圖片的新替代文字說明。 |
回攻員
OverGridImage - 這個圖片,用於鏈結。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
setAltTextTitle(title)
設定這張圖片的替代文字標題。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
title | String | 圖片的新替代文字標題。 |
回攻員
OverGridImage - 這個圖片,用於鏈結。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
setAnchorCell(cell)
設定圖片錨定的儲存格。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
cell | Range | 新的錨定儲存格。 |
回攻員
OverGridImage - 這個圖片,用於鏈結。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
setAnchorCellXOffset(offset)
設定與錨定儲存格的水平像素偏移量。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
offset | Integer | 新的水平像素偏移。 |
回攻員
OverGridImage - 這個圖片,用於鏈結。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
setAnchorCellYOffset(offset)
設定與錨定儲存格的垂直像素偏移量。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
offset | Integer | 新的垂直像素偏移。 |
回攻員
OverGridImage - 這個圖片,用於鏈結。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
setHeight(height)
以像素為單位設定圖片的實際高度。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
height | Integer | 所需高度 (以像素為單位)。 |
回攻員
OverGridImage - 鏈結的圖片。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
setWidth(width)
以像素為單位設定圖片的實際寬度。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
width | Integer | 所需的寬度 (以像素為單位)。 |
回攻員
OverGridImage - 鏈結的圖片。
授權
使用這個方法的指令碼需要下列一或多個範圍的授權:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets