office_image
Insert images into Word, Excel, or PowerPoint documents with support for PNG, JPG, and GIF. Specify target location and optional dimensions.
Instructions
Insert an image into a Word, Excel, or PowerPoint document.
Auto-detects document format from file extension and inserts the image at the specified location. Supports PNG, JPG/JPEG, and GIF formats.
Examples: # Insert image at end of Word document office_image( file_path="report.docx", image_path="logo.png", width_inches=2.0 )
# Insert image at specific paragraph in Word
office_image(
file_path="report.docx",
image_path="chart.png",
target="after:Executive Summary",
width_inches=5.0
)
# Insert image in Excel cell
office_image(
file_path="data.xlsx",
image_path="logo.png",
target="A1",
width_inches=1.5
)
# Insert image on specific Excel sheet
office_image(
file_path="data.xlsx",
image_path="chart.png",
target="Sheet2!B5"
)
# Insert image on PowerPoint slide
office_image(
file_path="deck.pptx",
image_path="diagram.png",
target="slide:2",
width_inches=4.0,
height_inches=3.0
)Args: file_path: Path to the document (.docx, .xlsx, .pptx) image_path: Path to the image file (.png, .jpg, .jpeg, .gif) target: Where to insert the image: - Word: "after:Section Title" or "end" (default) - Excel: cell reference like "A1" or "Sheet1!B5" - PowerPoint: "slide:N" where N is slide number (1-based) width_inches: Image width in inches (height auto-scales if not set) height_inches: Image height in inches (width auto-scales if not set) output_path: Optional output path (defaults to overwriting input)
Returns: Dictionary with insertion result
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Path to the document (.docx, .xlsx, .pptx) | |
| image_path | Yes | Path to the image file (.png, .jpg, .jpeg, .gif) | |
| target | No | Where to insert the image | |
| width_inches | No | Image width in inches (height auto-scales if not set) | |
| height_inches | No | Image height in inches (width auto-scales if not set) | |
| output_path | No | Optional output path (defaults to overwriting input) |