Skip to main content

Save pyexcel data with XlsxWriter, while retaining good formatting.

Project description


Build Status PyPI version PyPI license PyPI pyversions

Save pyexcel data with XlsxWriter, while retaining good formatting.


  • Allow setting column widths and word wrap.
  • A package for reading data is not included, please see pyexcel's plugins here.


$ pip install pyexcel-xlsxwx

Note that pyexcel is not a dependency.


>>> import pyexcel_xlsxwx
>>> data = OrderedDict() # from collections import OrderedDict
>>> data.update({"Sheet 1": [[1, 2, 3], [4, 5, 6]]})
>>> data.update({"Sheet 2": [["row 1", "row 2", "row 3"]]})
>>> pyexcel_xlsxwx.save_data("your_file.xlsx", data)

You can also define a custom config via:

>>> pyexcel_xlsxwx.save_data("your_file.xlsx", data, config=config)

Where config can be dictionary or path to YAML file.

The default YAML config is:

  constant_memory: true
  strings_to_numbers: false
  strings_to_formulas: false
  strings_to_urls: true
    freeze_panes: A2
#    column_width: 30
    smart_fit: true
    max_column_width: 30
    valign: top
    text_wrap: true

column_width can also accept a list and a dictionary where key indicates the column.

row_height can also be set the same way.

To cancel out freeze_panes, try:

>>> pyexcel_xlsxwx.save_data("your_file.xlsx", data, config={'worksheet': {'_default': {'freeze_panes': None}}})

The settings will merge (thanks to, so that the other formattings won't be lost.

Related projects

  • pyexcel-openpyxlx - export the styles for XlsxWriter.
  • pyexcel-export - operates using OpenPyXL, which seeming has bad word wrap support. However, the formatting can be well preserved.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyexcel-xlsxwx, version 0.1.7
Filename, size File type Python version Upload date Hashes
Filename, size pyexcel_xlsxwx-0.1.7-py3-none-any.whl (10.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pyexcel-xlsxwx-0.1.7.tar.gz (4.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page