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
get |
Returns the format of the image. |
get |
Specifies the shape identifier for the image object. |
get |
Returns the |
Method Details
getFormat()
getId()
Specifies the shape identifier for the image object.
getId(): string;
Returns
string
getShape()
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Scripts