openpyxl
A Python library to read/write Excel 2010 xlsx/xlsm files. Current version: 3.1.5. Openpyxl is actively maintained with regular updates to support the latest Excel features and Python versions.
Warnings
- breaking Openpyxl does not guard against XML-based attacks like quadratic blowup or billion laughs attacks by default. To mitigate these risks, install the 'defusedxml' package. ([openpyxl.readthedocs.io](https://openpyxl.readthedocs.io/en/3.1.0/?utm_source=openai))
Install
-
pip install openpyxl
Imports
- Workbook
from openpyxl import Workbook
Quickstart
from openpyxl import Workbook
# Create a new workbook and select the active worksheet
wb = Workbook()
ws = wb.active
# Write data to a cell
ws['A1'] = 'Hello, World!'
# Save the workbook
wb.save('example.xlsx')