Stay organized with collections Save and categorize content based on your preferences.
OverGridImageRepresents an image over the grid in a spreadsheet.
Methods Deprecated methods Method Return type Brief descriptiongetUrl()
String
Gets the image's source URL. Detailed documentation assignScript(functionName)
Assigns the function with the specified function name to this image.
Parameters Name Type DescriptionfunctionName
String
The name of the function being specified. This must be a public top level function, not one ending in underscore such as privateFunction_
. Return
OverGridImage
— This image, for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getAltTextDescription()
Returns the alt text description for this image.
ReturnString
— The alt text description.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getAltTextTitle()
Returns the alt text title for this image.
ReturnString
— The alt text title.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getAnchorCell()
Returns the cell where an image is anchored.
ReturnRange
— The anchor cell.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getAnchorCellXOffset()
Returns the horizontal pixel offset from the anchor cell.
ReturnInteger
— The horizontal pixel offset.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getAnchorCellYOffset()
Returns the vertical pixel offset from the anchor cell.
ReturnInteger
— The vertical pixel offset.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getHeight()
Returns the actual height of this image in pixels.
// 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()); }Return
Integer
— The height of the image in pixels.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getInherentHeight()
Returns the inherent height of this image in pixels.
ReturnInteger
— The inherent height in pixels.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getInherentWidth()
Returns the inherent height of this image in pixels.
ReturnInteger
— The inherent width in pixels.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getScript()
Returns the name of the function assigned to this image.
ReturnString
— The name of the function.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getSheet()
Returns the sheet this image appears on.
// 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()); }Return
Sheet
— The sheet the image appears on.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getWidth()
Returns the actual width of this image in pixels.
// 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()); }Return
Integer
— The width of the image in pixels.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
remove()
Deletes this image from the spreadsheet. Any further operation on the image results in a script error.
// Deletes all images in a spreadsheet const images = SpreadsheetApp.getActiveSpreadsheet().getImages(); for (let i = 0; i < images.length; i++) { images[i].remove(); }Authorization
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
replace(blob)
Replaces this image with the one specified by the provided BlobSource
. The maximum supported blob size is 2MB.
blob
BlobSource
The new image as a Blob. Return
OverGridImage
— This image, for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
replace(url)
Replaces this image with the one from the specified URL.
Parameters Name Type Descriptionurl
String
The URL of the new image. Return
OverGridImage
— This image, for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
resetSize()
Resets this image to its inherent dimensions.
ReturnOverGridImage
— This image, for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setAltTextDescription(description)
Sets the alt-text description for this image.
Parameters Name Type Descriptiondescription
String
The new alt text description for the image. Return
OverGridImage
— This image, for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setAltTextTitle(title)
Sets the alt text title for this image.
Parameters Name Type Descriptiontitle
String
The new alt text title for the image. Return
OverGridImage
— This image, for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setAnchorCell(cell)
Sets the cell where an image is anchored.
Parameters Name Type Descriptioncell
Range
The new anchor cell. Return
OverGridImage
— This image, for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setAnchorCellXOffset(offset)
Sets the horizontal pixel offset from the anchor cell.
Parameters Name Type Descriptionoffset
Integer
The new horizonal pixel offset. Return
OverGridImage
— This image, for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setAnchorCellYOffset(offset)
Sets the vertical pixel offset from the anchor cell.
Parameters Name Type Descriptionoffset
Integer
The new vertical pixel offset. Return
OverGridImage
— This image, for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setHeight(height)
Sets the actual height of this image in pixels.
Parameters Name Type Descriptionheight
Integer
The desired height in pixels. Return
OverGridImage
— The image for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setWidth(width)
Sets the actual width of this image in pixels.
Parameters Name Type Descriptionwidth
Integer
The desired width in pixels. Return
OverGridImage
— The image for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getUrl()
Deprecated. For most newly inserted images, the source URL is unavailable.
Gets the image's source URL. Returns an empty string if the URL is unavailable. For most newly inserted images, the source URL is unavailable regardless how the image is inserted.
ReturnString
— The image's source URL if available; returns an empty string otherwise.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-09 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-09 UTC."],[[["`OverGridImage` represents an image overlaid on a spreadsheet grid, offering methods to control its properties and behavior."],["It provides methods for manipulating the image's size, position, anchoring, alt text, and assigned script."],["Users can replace the image, reset its size, get its URL and dimensions, and remove it from the spreadsheet."],["Each method requires specific authorization scopes, primarily `https://www.googleapis.com/auth/spreadsheets.currentonly` or `https://www.googleapis.com/auth/spreadsheets`, to execute."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4