Convert Excel to Image in Java

This article demonstrates how to convert Excel to Image using Spire.XLS for Java.

Below screenshot shows the input Excel file we used for demonstration:

Convert Excel to Image in Java

import com.spire.xls.*;
import java.io.*;

public class ExcelToImage {
    public static void main(String[] args) throws IOException {
        //Create a workbook instance
        Workbook workbook = new Workbook();
        //Load the Excel file
        workbook.loadFromFile("Chart.xlsx");

        //Get the first worksheet
        Worksheet sheet = workbook.getWorksheets().get(0);

        //Save the sheet to image
        sheet.saveToImage("image.png");
    }
}

The output image file:

Convert Excel to Image in Java