Class CellImageBuilder

CellImageBuilder

Builder for CellImage. This builder creates the image value needed to add an image to a cell.

Properties

PropertyTypeDescription
valueTypeValueTypeA field set to ValueType.IMAGE, representing the image value type.

Methods

MethodReturn typeBrief description
build()CellImageCreates the image value type needed to add an image to a cell.
getAltTextDescription()StringReturns the alt text description for this image.
getAltTextTitle()StringReturns the alt text title for this image.
getContentUrl()StringReturns a Google-hosted URL to the image.
getUrl()StringGets the image's source URL; returns null if the URL is unavailable.
setAltTextDescription(description)CellImageSets the alt-text description for this image.
setAltTextTitle(title)CellImageSets the alt text title for this image.
setSourceUrl(url)CellImageBuilderSets the image source URL.
toBuilder()CellImageBuilderCreates a builder that turns an image into an image value type so that you can place it into a cell.

Detailed documentation

build()

Creates the image value type needed to add an image to a cell. The image value is built from the image properties added to the builder, such as the source URL.

Return

CellImage — A representation of the image to add to a cell.


getAltTextDescription()

Returns the alt text description for this image.

Return

String — The alt text description.

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

getAltTextTitle()

Returns the alt text title for this image.

Return

String — The alt text title.

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

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.

Return

String — The Google-hosted URL of the image.


getUrl()

Gets the image's source URL; returns null if the URL is unavailable. If the image was inserted by URL using an API, this method returns the URL provided during image insertion.

Return

String — The image URL if available; returns null if the image is unavailable or doesn't have a source URL.

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

setAltTextDescription(description)

Sets the alt-text description for this image.

Parameters

NameTypeDescription
descriptionStringThe new alt text description for the image.

Return

CellImage — This image, for chaining.

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

setAltTextTitle(title)

Sets the alt text title for this image.

Parameters

NameTypeDescription
titleStringThe new alt text title for the image.

Return

CellImage — This image, for chaining.

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

setSourceUrl(url)

Sets the image source URL.

Parameters

NameTypeDescription
urlStringThe URL for the image.

Return

CellImageBuilder — This builder, for chaining.


toBuilder()

Creates a builder that turns an image into an image value type so that you can place it into a cell. Before an image is placed into a cell, it needs to be created as an image value type. Then you can add it to a cell using Range.setValue(value) or Range.setValues(values).

Return

CellImageBuilder — A builder that creates an image value type based on the given image properties.