
Getting Started with XlsxWriter
Once you are happy that the module is installed and operational you can have a look at the rest of the XlsxWriter documentation. Tutorial 1: Create a simple XLSX file is a good place to start.
The Worksheet Class — XlsxWriter
Full workbook encryption is not supported by XlsxWriter. However, it is possible to encrypt an XlsxWriter file using a third party open source tool called msoffice-crypt.
Tutorial 1: Create a simple XLSX file — XlsxWriter
Let’s start by creating a simple spreadsheet using Python and the XlsxWriter module. Say that we have some data on monthly outgoings that we want to convert into an Excel XLSX file:
Working with and Writing Data — XlsxWriter
Writing compound data types such as lists with XlsxWriter is done the same way it would be in any other Python program: with a loop. The Python enumerate() function is also very useful in this context:
Introduction — XlsxWriter
XlsxWriter is a Python module for writing files in the Excel 2007+ XLSX file format. It can be used to write text, numbers, and formulas to multiple worksheets and it supports features such as formatting, …
The Workbook Class — XlsxWriter
The Workbook class is the main class exposed by the XlsxWriter module and it is the only class that you will need to instantiate directly. The Workbook class represents the entire spreadsheet as you see it …
Working with Pandas and XlsxWriter
In order to apply XlsxWriter features such as Charts, Conditional Formatting and Column Formatting to the Pandas output we need to access the underlying workbook and worksheet objects.
Working with Formulas — XlsxWriter
XlsxWriter doesn’t calculate the result of a formula and instead stores the value 0 as the formula result. It then sets a global flag in the XLSX file to say that all formulas and functions should be recalculated …
Working with Conditional Formatting — XlsxWriter
The conditional_format() worksheet method is used to apply formatting based on user defined criteria to an XlsxWriter file. The conditional format can be applied to a single cell or a range of cells.
Tutorial 2: Adding formatting to the XLSX File — XlsxWriter
In the previous section we created a simple spreadsheet using Python and the XlsxWriter module. This converted the required data into an Excel file but it looked a little bare.