
Adding pictures to Excel files helps make your spreadsheets easier to understand. Images can support your data, highlight key points, and improve the overall look of your reports. In this blog post, you will learn how to add a photo to Excel in Java. We will guide you through each step using simple Java code examples. By the end, you will be able to add images to your Excel files quickly and efficiently.
This article covers the following:
- Java Excel library to add a photo
- How to add a photo to Excel
- Add a picture based on cell reference
- Explore free resources
Java Excel Library to Add a Photo
Aspose.Cells for Java is a powerful library for working with Excel files in Java. It allows you to insert images, format cells, and generate Excel documents programmatically. You can add, move, or resize pictures easily.
To install Aspose.Cells for Java, use Maven:
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-cells</artifactId>
<version>25.6</version>
</dependency>
Or download it from the official releases page.
How to Add a Picture to Excel in Java
Please follow these steps to add a photo to Excel using Java:
- Create a
Workbook
object. - Access the desired worksheet.
- Use
Pictures.add()
to insert the image. - Save the workbook.
Here is a sample Java code:

How to Add a Photo to Excel in Java
Add a Picture Based on Cell Reference
You can add a picture at a specific cell reference too by following the steps below:
- Create a
Workbook
class object. - Access the target worksheet from the Worksheets collection.
- Add text or data to the relevant cells.
- Use the
addPicture()
method to insert the photo at a specific cell. - Set the image size or position if needed.
- Save the workbook using the
save()
method.

Add a Picture Based on Cell Reference
Get a Free License
You can request a free temporary license to evaluate all features without limitations. Visit the temporary license page to get yours today.
Add Picture to Excel: Free Resources
Explore more Aspose resources to boost your Excel automation projects:
Conclusion
In this article, we learned how to add a photo to Excel using Java and Aspose.Cells. With simple code, you can enhance your worksheets with images. Try it out and explore more features in Aspose.Cells for Java.
If you need help, visit our support forum.