Monday, January 13, 2014

Create neat excel files in Python using XlsxWriter

Working with Excel files is not always a great pleasure for me, but regardless of my feelings its a great tool for a lots of situations where dealing with data is easier and faster with Excel.  As a programmer I tend to find alternatives to not deal with data directly and build some type of software layer around it to deal with data in Excel files.  If you feel like being in the same boat and love python then you must use XlsxWriter.

XlsxWriter - as name suggests is a python package to create/update Excel files.  XlsxWriter supports latest 'xlsx' file format and that is a must have feature as most of the excel files are now in this new format. The list of supported features is huge, but the ones that are important to me is below:

  • Compatibility with XLSX file format
  • Formulas
  • Formatting support
  • Data Validation
  • Defined names
  • Charts
  • Outlining and Grouping

As with most of the open-source tools/packages you won't find a lot of documentation and you'll have to dig through the auto-generated APIs or source code to find out all the available functions and what different arguments means, its not the case for XlsxWriter.  It has a great set of 'Intro' documents (Getting Started, Tutorial-1, Tutorial-2, Tutorial-3), that helps you to quickly get started with this package.  And once you are hooked to XlsxWriter, you an go through the rest of documentation to find out how to use a specific feature you are interested in.  And this package has 40+ examples of showing how to use various features available in this package to generate great Excel files.

No comments:

Post a Comment