ExcelScript.Image interface

Represents an image in the worksheet. To get the corresponding Shape object, use Image.getShape.

Remarks

Examples

/**
 * This script transfers an image from one worksheet to another.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the worksheet with the image on it.
  const firstWorksheet = workbook.getWorksheet("FirstSheet");

  // Get the first image from the worksheet.
  // If a script added the image, you could add a name to make it easier to find.
  let image: ExcelScript.Image;
  firstWorksheet.getShapes().forEach((shape, index) => {
    if (shape.getType() === ExcelScript.ShapeType.image) {
      image = shape.getImage();
      return;
    }
  });

  // Copy the image to another worksheet.
  image.getShape().copyTo("SecondSheet");
}

Methods

getFormat()

Returns the format of the image.

getId()

Specifies the shape identifier for the image object.

getShape()

Returns the Shape object associated with the image.

Method Details

getFormat()

Returns the format of the image.

getFormat(): PictureFormat;

Returns

getId()

Specifies the shape identifier for the image object.

getId(): string;

Returns

string

getShape()

Returns the Shape object associated with the image.

getShape(): Shape;

Returns