Quick Start
Quick Start
This page walks through the minimum steps needed to create a spreadsheet, write data to cells, and save it in XLSX, CSV, or Markdown format using Aspose.Cells FOSS for Python.
Prerequisites
| Requirement | Detail |
|---|---|
| Python | 3.7 or later |
| Package | aspose-cells-foss >= 26.3.1 |
| OS | Windows, macOS, or Linux |
| Microsoft Office | Not required |
Step 1 — Install
pip install aspose-cells-foss>=26.3.1Step 2 — Create a Workbook
Workbook() creates a new empty workbook. Add a worksheet with add_worksheet():
from aspose.cells_foss import Workbook, SaveFormat
wb = Workbook()
ws = wb.add_worksheet("Sheet1")Step 3 — Write Cell Values
Access cells via Worksheet.cells, then call Cells.cell(row, col) to get a Cell
and Cell.put_value() to set its value:
cells = ws.cells
cells.cell(0, 0).put_value("Name")
cells.cell(0, 1).put_value("Score")
cells.cell(1, 0).put_value("Alice")
cells.cell(1, 1).put_value(95)
cells.cell(2, 0).put_value("Bob")
cells.cell(2, 1).put_value(88)Step 4 — Save to XLSX
Workbook.save() writes the workbook to disk. Pass a SaveFormat constant to
control the output format:
wb.save("output.xlsx", SaveFormat.XLSX)Step 5 — Load and Read
Load an existing file by passing the path to Workbook(file_path). Read values via
the Cell.value property:
from aspose.cells_foss import Workbook
wb = Workbook("output.xlsx")
ws = wb.get_worksheet(0)
print(ws.cells.cell(0, 0).value) # "Name"
print(ws.cells.cell(1, 1).value) # 95Export to CSV or Markdown
wb.save("output.csv", SaveFormat.CSV)
wb.save("output.md", SaveFormat.MARKDOWN)