Frequently Asked Questions

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.1

After 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(address).put_value(value) when you have a string cell address:

ws.cells.get("A1").put_value("Product")
ws.cells.get("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"].value

For more control (delimiter, encoding, etc.), use CSVHandler with CSVLoadOptions:

from aspose.cells_foss import Workbook, CSVHandler, CSVLoadOptions

opts = CSVLoadOptions()
opts.delimiter = ';'
opts.encoding = 'utf-8'
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_idx = ws.charts.add_bar(5, 0, 20, 8)
chart = ws.charts[chart_idx]
chart.title = "Monthly Sales"
chart.n_series.add("B2:B3", 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.value

What file formats can be loaded?

FormatExtensionHow to load
Excel 2007–2019.xlsxWorkbook("file.xlsx")
Excel 97–2003.xlsWorkbook("file.xls")
CSV.csvload_csv_workbook("file.csv")

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.