Skip to content

Image To Excel

With the Image to Excel tool, you can convert your Image file into a Excel file. The following examples show how to upload a test Image file and convert it into a Excel file using Java languages.

java
// Create a client
CPDFClient client = new CPDFClient(publicKey,secretKey);

// Create a task
// Create an example of a Image to Excel task
CPDFCreateTaskResult result = client.createTask(CPDFConversionEnum.IMAGE_TO_EXCEL);

// Get a task id
String taskId = result.getTaskId();

// File handling parameter settings
CIMGToExcelParameter fileParameter = new CIMGToExcelParameter();
fileParameter.setIsAllowOcr(CIMGToExcelParameter.IS_ALLOW_OCR);

// Upload files
client.uploadFile(new File("test.jpg"), taskId, fileParameter);

// Execute task
client.executeTask(taskId);

// Query TaskInfo
CPDFTaskInfoResult taskInfo = client.getTaskInfo(taskId);

Needed Parameters

contentOptions: Options to extract contents (1: only text, 2: only table, 3: all content) Default 2.

worksheetOptions: Options to create worksheet (1: create a sheet for each table, 2: create a sheet for each page, 3: create a single sheet for file) Default 1.

isAllowOcr: Whether to allow to open OCR (1: yes, 0: no), Default 0.

isContainOcrBg: Whether to keep the background image after OCR is enabled (1: yes, 0: no) Default 0.

isOnlyAiTable: Whether to enable AI to recognize table (1: yes, 0: no) Default 0.

Result:

File TypeDescription
.xlsxThe Excel file after the transfer process is completed.