Loading and managing Excel,OpenOffice,Json, Csv and Html files

Creating a New Workbook

The following example creates a new workbook from the scratch.

Opening and saving a File

With Aspose.Cells for Python via .NET, it is simple to open, save and mange Excel files.

from aspose.cells import Workbook
from datetime import datetime
dataDir = "./"
# Opening through Path
# Creating a Workbook object and opening an Excel file using its file path
workbook1 = Workbook(dataDir + "Book1.xlsx")
# Adding new sheet
sheet = workbook1.worksheets.add("MySheet")
# Setting active aheet
workbook1.worksheets.active_sheet_index = 1
# Setting values.
cells = sheet.cells
# Setting text
cells.get("A1").put_value("Hello!")
# Setting number
cells.get("A2").put_value(1000)
# Setting Date Time
cell = cells.get("A3")
cell.value = datetime.now()
style = cell.get_style()
style.number = 14
cell.set_style(style)
# Setting formula
cells.get("A4").formula = "=SUM(A1:A3)"
# Saving the workbook to disk.
workbook1.save("dest.xlsx")

Advance topics