Package excelize-py is a Python port of Go Excelize library, providing a set of functions that allow you to write and read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and writing spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports complex components by high compatibility, and provided streaming API for generating or reading data from a worksheet with huge amounts of data. This library needs Python version 3.7 or later. The full API docs can be found at docs reference.
pip install excelize
Here is a minimal example usage that will create spreadsheet file.
import excelize
f = excelize.new_file()
# Create a new sheet.
index, err = f.new_sheet("Sheet2")
if err is not None:
print(err)
exit()
# Set value of a cell.
f.set_cell_value("Sheet2", "A2", "Hello world.")
f.set_cell_value("Sheet1", "B2", 100)
# Set active sheet of the workbook.
f.set_active_sheet(index)
# Save spreadsheet by the given path.
err = f.save_as("Book1.xlsx")
if err is not None: {
print(err)
}
err = f.close()
if err is not None: {
print(err)
}