Convert-Excel-to-JSON

How to Convert Excel Workbook to JSON

No need to wonder how to convert Excel Workbook to JSON, because Aspose.Cells Java library has best decision. The Aspose.Cells Java API provides support for converting spreadsheets to JSON format. To export the workbook to JSON, pass SaveFormat.JSON as the second parameter of Workbook.save method. You may also use JsonSaveOptions class to specify additional settings for exporting worksheet to JSON.

The following code example demonstrates exporting Excel Workbook to Json. Please see the code to convert source file to the Json file generated by the code for reference.

//Load Source Excel file
Workbook workbook = new Workbook("sample.xlsx");
//Save the workbook in JSON format
workbook.save("sample_out.json", SaveFormat.JSON);

The following code example which uses JsonSaveOptions class to specify additional settings demonstrates exporting Excel Workbook to Json. Please see the code to convert source file to the Json file generated by the code for reference.

//Create an options of saving the file.
JsonSaveOptions options = new JsonSaveOptions();
//Set the exporting range.
options.setExportArea(CellArea.createCellArea("B1", "C4"));
//Load Source Excel file
Workbook workbook = new Workbook("sample.xlsx");
//Save the workbook in JSON format
workbook.save("sample_out.json", options);