This section shows changes and bug fixes in the XlsxWriter module.
Added support for enabling the Excel “Show #N/A as an empty cell” chart option
via the chart.show_na_as_empty_cell()
method.
Added support for custom total formulas to worksheet tables.
worksheet.set_pagebreak_view()
.Add support for new Excel dynamic functions added in 2023.
Added support for adding a color to the invert_if_negative chart option.
autofit()
exception when user defined column width was None
.Improved autofit()
algorithm to account for the additional width of
autofilter and table dropdowns.
Improved autofit()
take user defined column widths into account.
Autofit will now only update the width for an existing column if it is greater than the user defined value. This allows the user to pre-load a minimum column width.
Added simulated worksheet autofit()
method.
Added OverlappingRange
exception which is raised during Worksheet
add_table()
or merge_range()
if the range overlaps an existing
worksheet table or merge range. This is a file corruption error in Excel. See
The Exceptions Class.
Added print_black_and_white()
worksheet method to set “Black and
White” print options.
Added set_top_left_cell()
worksheet method to position the first
visible cell in a worksheet.
This is the first Python 3 only version of XlsxWriter. It is approximately 10-15% faster than the Python2/3 version.
Python 2 users should use XlsxWriter version 2.0.0, see below.
This is the last XlsxWriter release to support Python 2. From now bug fixes and new features will only be available for Python 3. The deprecation notice for Python 2 support in XlsxWriter has been in place since May 2020 and the Python community support for Python 2 ended in January 2020. Downloads of XlsxWriter for Python 2 is currently less than 6% of all downloads of the library, and decreasing month by month.
Python 2 users should still be able to install versions of XlsxWriter up to this release but not any releases afterwards.
- Added Description/Alt Text and Decorative accessibility options for charts, textboxes and buttons. These options were already available for images.
set_background()
and Example: Setting the Worksheet Background.write_dynamic_array_formula()
,
Dynamic Array support and Example: Dynamic array formulas.Workbook()
constructor.set_row_pixels()
and set_column_pixels()
methods.insert_image()
. Feature Request #768.read_only_recommended()
method to set the Excel
“Read-only Recommended” option that is available when saving a file.
Feature Request #784.unprotect_range()
method to allow ranges within
a protected worksheet to be unprotected. Feature Request #507.use_zip64
as a constructor option. Issue #745.write_rich_string()
exceeds
Excel’s limit. Issue #372.ignore_errors()
worksheet method to to allow Excel worksheet
errors/warnings to be ignored in user defined ranges. See also
Example: Ignoring Worksheet errors and warnings. Feature Request #678.close()
to help
avoid errors where a file is closed within a loop or at the wrong scope
level.stacked
and percent_stacked
Line charts.ReservedWorksheetName
exception which was used with the reserved
worksheet name “History” since this name is allowed in some Excel variants.
Issue #688.add_write_handler()
.
Issue #677.protect()
about how it is possible to encrypt an
XlsxWriter file using a third party, cross platform, open source tool called
msoffice-crypt.max_url_length
property in the Workbook()
constructor.add_write_handler()
method to allow user defined types to be
handled by the write()
method. See Writing user defined types for more
information. Feature Request #631.close()
method to allow exceptions to be caught and handled. See
Example: Catch exception on closing. Also refactored the code to clean up temp files in
the event of an exception. :issue`471` and Issue #647.object_position
. The
previous parameter name positioning
is deprecated but still supported
for images. Issue #568.file(1)
. The mime-type reported
by “file –mime-type”/magic was incorrect for XlsxWriter files since it
expected the [Content_types]
to be the first file in the zip container.
Issue #614.'num_format': '0'
in duplicate formats. Issue #584.in_memory
files weren’t compressed. Issue #573.write()
so that it handles array formulas as documented.
Issue #418.write_rich_string()
such as blank
strings, double formats or insufficient parameters. Issue #425.label_align
property of the set_x_axis()
method.hide_row_col_headers()
method to turn off worksheet
row and column headings. Issue #480.set_tab_ratio()
method to set the ratio between the
worksheet tabs and the horizontal slider. Issue #481.close()
in the destructor since it wasn’t
guaranteed to work correctly and raised a confusing exception when any other
exception was triggered. Note that this is a backward incompatible
change. The with
context manager is a better way to close
automatically, see close()
.set_legend()
. Issue #545.top_right
position to set_legend()
. Issue #537.add_image()
method.set_properties()
created
date is set. Pull Request #495.set_column()
parameter names to match docs and other methods.
Note, this is a backward incompatible change. Issue #504.write_url()
format to the Excel hyperlink style so
that it changes when the theme is changed and also so that it indicates that
the link has been clicked. Feature Request #455.stop_if_true
parameter to conditional formatting. Feature Request #386.-Werror
mode. Issue #451.Workbook()
constructor option remove_timezone
and Timezone
Handling in XlsxWriter. Issue #257.add_table()
when there is only one
user defined header. Issue #380.add_format()
. Issue #381.add_table()
to prevent duplicate header names which
leads to a corrupt Excel file. Issue #362.set_size()
method to set the workbook window size.set_table()
.intercept
, display_equation
and display_r_squared
.
Feature Request #357.insert_image()
issue when handling images with zero dpi.
Issue #356.set_custom_property()
method to set custom document
properties. Feature Request #355.get_worksheet_by_name()
method to allow the retrieval of a
worksheet from a workbook via its name.external:
urls where the target/anchor contains spaces.
Issue #350.set_center_across()
format method.write_url()
exception when the URL contains two #
location/anchors. Note, URLs like this aren’t strictly valid and cannot be
entered manually in Excel.
Issue #330.set_x_axis()
.hyperlink_base
document property.
Feature Request #306.with
context manager.
:PR`239`.insert_textbox()
and
Working with Textboxes for more details.
Feature Request #107.set_x_axis()
.
Feature Request #185.nan_inf_to_errors
Workbook()
constructor option to allow
mapping of Python nan/inf value to Excel error formulas in write()
and
write_number()
.
Feature Request #150.add_table()
.
Feature Request #216.set_header()
.
Feature Request #134.egg_base
requirement from setup.cfg
which was preventing
installation on Windows.
Issue #162.write()
clearer for unsupported types so
that it raises a more accurate TypeError instead of a ValueError.
Issue #153.insert_image()
images from byte streams to allow
images from URLs and other sources.
Feature Request #118.write_datetime()
support for datetime.timedelta.
Feature Request #128.close()
isn’t used.
Issue #131.print_area()
documentation for complete row/column ranges.
Issue #139.insert_chart()
and
set_size()
.insert_image()
to control how
images are moved in relation to surrounding cells.
Feature Request #117.error_bar
exceptions.
Issue #115.write()
methods.
Pull Request #108.inside_base
data label position in charts.set_calc_mode()
method to control automatic calculation of
formulas when worksheet is opened. Thanks to Chris Tompkinson.use_zip64()
method to allow ZIP64 extensions when writing
very large files.in_memory
mode.
Issue #102.set_column()
entries.
Issue #82.set_title()
none
option to turn off automatic titles.define_name()
name validation.conditional_format()
.in_memory
Workbook()
constructor option to allow XlsxWriter
to work on Google App Engine.
Feature Request #28.position_axis
chart axis option.write_url()
.Workbook()
constructor options strings_to_formulas
and
strings_to_urls
to override default conversion of strings in write().insert_image()
for images that extend
over several cells.write()
function.write_boolean()
function to write Excel boolean values.
Feature Request #37. Also added explicit handling of Python bool values to the
write()
function.Workbook()
constructor option
strings_to_numbers
default option to False so that there is no implicit
conversion of numbers in strings to numbers. The previous behavior can be
obtained by setting the constructor option to True.
Note This is a backward incompatibility.Workbook()
constructor option strings_to_numbers
to
override default conversion of number strings to numbers in write().Workbook()
constructor option default_date_format
to
allow a default date format string to be set.
Feature Request #5.Added worksheet tables. See Working with Worksheet Tables and Example: Worksheet Tables.
Tested with the new Python stable releases 2.7.4 and 3.3.1. All tests now pass in the following versions:
- Python 2.6
- Python 2.7.2
- Python 2.7.3
- Python 2.7.4
- Python 3.1
- Python 3.2
- Python 3.3.0
- Python 3.3.1
There are now over 700 unit tests including more than 170 tests that compare against the output of Excel.
set_default_row()
method. See Example: Hiding Rows and Columns.freeze_panes()
and split_panes()
methods.
See Example: Freeze Panes and Split Panes .set_selection()
method to select worksheet cell or range of
cells.Workbook()
parameters 'tmpdir'
and
'date_1904'
.Workbook()
'constant_memory'
constructor property to
minimize memory usage when writing large files. See Working with Memory and Performance
for more details.data_validation()
method, Working with Data Validation and Example: Data Validation and Drop Down Lists.write_datetime()
method. Issue #3.
Thanks to Eduardo (eazb) and Josh English for the prompt.conditional_format()
method,
Working with Conditional Formatting and Example: Conditional Formatting.Added Python 2.6 support. All tests now pass in the following versions:
- Python 2.6
- Python 2.7.2
- Python 2.7.3
- Python 3.1
- Python 3.2
- Python 3.3.0
write_comment()
and Working with Cell Comments.insert_image()
worksheet method to support inserting PNG and
JPEG images into a worksheet. See also the example program
Example: Inserting images into a worksheet.write_rich_string()
worksheet method to allow writing of
text with multiple formats to a cell. Also added example program:
Example: Writing “Rich” strings with multiple formats.hide()
worksheet method to hide worksheets.set_first_sheet()
worksheet method.protect()
worksheet method to allow protection of cells
from editing. Also added example program: Example: Enabling Cell protection in Worksheets.Added worksheet methods:
set_zoom()
for setting worksheet zoom levels.right_to_left()
for middle eastern versions of Excel.hide_zero()
for hiding zero values in cells.set_tab_color()
for setting the worksheet tab color.
write_row()
and write_column()
worksheet methods.write_url()
worksheet method for writing hyperlinks to
a worksheet.Added the set_properties()
workbook method for setting document
properties.
Added several new examples programs with documentation. The examples now include:
- array_formula.py
- cell_indentation.py
- datetimes.py
- defined_name.py
- demo.py
- doc_properties.py
- headers_footers.py
- hello_world.py
- merge1.py
- tutorial1.py
- tutorial2.py
- tutorial3.py
- unicode_polish_utf8.py
- unicode_shift_jis.py
define_name()
method to create defined names and ranges
in a workbook or worksheet.worksheets()
method as an accessor for the worksheets in a
workbook.merge_range()
method to merge worksheet cells.Added final page setup methods to complete the page setup section.
Added page setup method.
Added page setup methods.
Added Python 3 support with help from John Evans. Tested with:
- Python-2.7.2
- Python-2.7.3
- Python-3.2
- Python-3.3.0
Added page setup methods.
Added page setup method.
Added page setup methods.