XlsxWriter

3.2.9 · active · verified Sat Mar 28

XlsxWriter is a Python module for creating Excel XLSX files. It supports Python 3.8+ and PyPy3 and uses standard libraries only. It offers comprehensive features for writing, formatting, and customizing Excel spreadsheets, including charts, formulas, data validation, and images. It is actively maintained with regular releases.

Warnings

Install

Imports

Quickstart

This quickstart creates a new Excel file named `hello.xlsx`, adds a single worksheet, writes 'Hello XlsxWriter!' to cell A1, and saves the file.

import xlsxwriter

# Create a new Excel file and add a worksheet.
workbook = xlsxwriter.Workbook('hello.xlsx')
worksheet = workbook.add_worksheet()

# Write a simple string to cell A1.
worksheet.write('A1', 'Hello XlsxWriter!')

# Close the workbook to save the file.
workbook.close()
print("Created hello.xlsx")

view raw JSON →