Frequently Asked Questions
Frequently Asked Questions
How do I install Aspose.Cells FOSS?
Install it from PyPI using pip:
pip install aspose-cells-foss>=26.3.1After installation, verify it works:
from aspose.cells_foss import Workbook
wb = Workbook()
print("Installation successful")How do I read a cell value?
Use the .value property; it is a property, not a method. Do not add parentheses.
from aspose.cells_foss import Workbook
wb = Workbook("input.xlsx")
ws = wb.worksheets[0]
# Correct: .value is a property (no parentheses)
val = ws.cells["A1"].value
print(val)
# Also correct: access by row, column index (1-based)
val2 = ws.cells[1, 1].value
print(val2)How do I write a cell value or formula?
Assign to .value or .formula directly. Both are properties, not methods.
from aspose.cells_foss import Workbook
wb = Workbook()
ws = wb.worksheets[0]
# Write a value
ws.cells["A1"].value = "Product"
ws.cells["B1"].value = 100
# Write a formula
ws.cells["C1"].formula = "=SUM(A1:B1)"
wb.save("output.xlsx")Alternatively, use cells.get_cell_by_name(address).put_value(value) when you have a string cell address:
ws.cells.get_cell_by_name("A1").put_value("Product")
ws.cells.get_cell_by_name("B1").put_value(100)Does Aspose.Cells FOSS support PDF export?
No. PDF export is not available in the FOSS edition. The supported save formats are:
- XLSX:
wb.save("output.xlsx") - CSV:
wb.save("output.csv") - Markdown:
wb.save_as_markdown("output.md")
How do I load a CSV file?
Use the load_csv_workbook() convenience function:
from aspose.cells_foss import load_csv_workbook
wb = load_csv_workbook("data.csv")
ws = wb.worksheets[0]
val = ws.cells["A1"].valueFor more control, use CSVHandler with CSVLoadOptions:
from aspose.cells_foss import Workbook, CSVHandler, CSVLoadOptions
opts = CSVLoadOptions()
wb = Workbook()
CSVHandler.load_csv(wb, "data.csv", opts)
ws = wb.worksheets[0]How do I add a chart?
Use one of the add_* methods on ws.charts. Each method takes positional arguments for the chart’s bounding box: top_row, left_col, bottom_row, right_col.
from aspose.cells_foss import Workbook
wb = Workbook()
ws = wb.worksheets[0]
# Add data
ws.cells["A1"].value = "Month"
ws.cells["B1"].value = "Sales"
ws.cells["A2"].value = "Jan"
ws.cells["B2"].value = 1200
ws.cells["A3"].value = "Feb"
ws.cells["B3"].value = 1500
# Add a bar chart (top_row, left_col, bottom_row, right_col)
chart = ws.charts.add_bar(5, 0, 20, 8)
chart.title = "Monthly Sales"
chart.n_series.add("B2:B3", is_vertical=True)
wb.save("output.xlsx")Why does cell.value() raise a TypeError?
Because .value is a property, not a method. Calling cell.value() attempts to call the returned value as a function, which raises TypeError. Always use assignment or direct attribute access:
# Wrong: raises TypeError
cell.value("Hello")
cell.formula("=SUM(A1:A5)")
val = cell.value()
# Correct
cell.value = "Hello"
cell.formula = "=SUM(A1:A5)"
val = cell.valueWhat file formats can be loaded?
| Format | Extension | How to load |
|---|---|---|
| XLSX | .xlsx | Workbook("file.xlsx") — Excel 2007 and later |
| CSV | .csv | load_csv_workbook("file.csv") |
Does Aspose.Cells FOSS support formula evaluation?
Formula strings are stored verbatim in XLSX cells using the .formula property. They are not evaluated by the library — Excel or LibreOffice evaluates them when the file is opened. There is no built-in formula calculator.
from aspose.cells_foss import Workbook
wb = Workbook()
ws = wb.worksheets[0]
ws.cells["A1"].value = 10
ws.cells["A2"].value = 20
ws.cells["A3"].formula = "=SUM(A1:A2)" # Stored verbatim, not evaluated at save time
wb.save("output.xlsx")Note on legacy XLS files: Only XLSX format is supported. Legacy XLS/BIFF files are not supported and cannot be loaded.
See Also
Aspose.Cells FOSS is licensed under the MIT License. Review the full license terms in the LICENSE file. For installation and basic usage, see the README and the examples directory.