Convert Excel to JSON

Converti Workbook Excel in JSON

Non c’è bisogno di chiedersi come convertire il Workbook Excel in JSON, perché la libreria Aspose.Cells for Python via .NET ha la migliore decisione. L’API Aspose.Cells fornisce supporto per la conversione di fogli di calcolo nel formato JSON. Per esportare il workbook in JSON, passa SaveFormat.JSON come secondo parametro del metodo Workbook.save. Puoi anche usare la classe JsonSaveOptions per specificare impostazioni aggiuntive per esportare il foglio di lavoro in JSON.

Il seguente esempio di codice dimostra l’esportazione di un Workbook Excel in Json. Si prega di vedere il codice per convertire il file di origine in un file Json generato dal codice per riferimento.

from aspose.cells import Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# Load your source workbook
workbook = Workbook("sample.xlsx")
# Convert the workbook to json file.
workbook.save("sample_out.json")

Il seguente esempio di codice che utilizza la classe JsonSaveOptions per specificare impostazioni aggiuntive dimostra l’esportazione di un Workbook Excel in Json. Si prega di vedere il codice per convertire il file di origine nel file Json generato dal codice per riferimento.

from aspose.cells import CellArea, JsonSaveOptions, Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# Create an options of saving the file.
options = JsonSaveOptions()
# Set the exporting range.
options.export_area = CellArea.create_cell_area("B1", "C4")
# Load your source workbook
workbook = Workbook("sample.xlsx")
# Convert the workbook to json file.
workbook.save("sample_out.json", options)