Stay organized with collections Save and categorize content based on your preferences.
Properties Property Type DescriptionvalueType
ValueType
The value type of the cell image, which is ValueType.IMAGE
. Methods Deprecated methods Method Return type Brief description getUrl()
String
Gets the image's source URL. Detailed documentation 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
getContentUrl()
Returns a Google-hosted URL to the image. This URL is tagged with the account of the requester, so anyone with the URL effectively accesses the image as the original requester. Access to the image might be lost if the spreadsheet's sharing settings change. The returned URL expires after a short period of time.
const range = SpreadsheetApp.getActiveSpreadsheet().getRange("Sheet1!A1"); const value = range.getValue(); if (value.valueType == SpreadsheetApp.ValueType.IMAGE) { console.log(value.getContentUrl()); }Return
String
— The Google-hosted URL of the image.
toBuilder()
Creates a cell image builder based on the current image properties. Use CellImageBuilder.setSourceUrl(url)
to set the source URL of the new image. Then you can add it to a cell using Range.setValue(value)
or Range.setValues(values)
.
const ss = SpreadsheetApp.getActiveSpreadsheet(); const range = ss.getRange("Sheet1!A1"); const value = range.getValue(); if (value.valueType == SpreadsheetApp.ValueType.IMAGE) { const newImage = value.toBuilder() .setSourceUrl( 'https://www.gstatic.com/images/branding/productlogos/apps_script/v10/web-64dp/logo_apps_script_color_1x_web_64dp.png', ) .build(); const newRange = ss.getRange("Sheet1!A2"); newRange.setValue(newImage); }Return
CellImageBuilder
— A builder that creates an image value type based on the given image properties.
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."],[[["`CellImage` allows you to add images to spreadsheet cells using `SpreadsheetApp.newCellImage()` and `CellImageBuilder`."],["You can set an image to a cell using `Range.setValue()` or `Range.setValues()`."],["`CellImage` provides methods to access image properties like alt text, content URL, and source URL."],["`toBuilder()` creates an image value type, necessary for placing images into cells."],["`CellImage` has a single property, `valueType`, which is always `ValueType.IMAGE`."]]],["To incorporate images into spreadsheet cells, create a new image value using `SpreadsheetApp.newCellImage()` and `CellImageBuilder`. Add the image to a cell via `Range.setValue()` or `Range.setValues()`. Key methods include: `getAltTextDescription()`, `getAltTextTitle()`, `getContentUrl()`, and `toBuilder()`. The method `getUrl()` is deprecated. `getContentUrl()` returns a Google-hosted URL to the image. `toBuilder()` creates a `CellImageBuilder` to modify image properties. `valueType` property is `ValueType.IMAGE`.\n"]]
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