views:

85

answers:

2

Is there any existing Python library that can validate data in Excel format? Or what kind of keyword should I use to search such an open source project? Thanks.

+1  A: 

I`m not sure what are you looking for, but there are three libraries that, in combination, can read and write excel files:

xlrd xlwt xlutils

They read and save binary excel archives both in windows and linux. There are functions for formatting data and styles.

If you want to check if some data column is in a given format you can do it with these libs (basically with xlrd).

joaquin
Thanks a lot! What I mean to data validation is same in Excel's native validation feature. Excel allow user to set some sort of rules to columns, like what value are acceptable, or only accept unique value. Where I want to automate this task for multiple Excel files. So I am looking something that can catch invalid data in Excel files and output those lines for easier fixing the errors.Thanks.
Stan
Stan, then you can do it with the above libs. If you want to use native Excel functions, then take a look at pywin32 lib (win32all) from Mark Hammond. With this library you can access Excel as a COM object and use native functions
joaquin
+2  A: 

[Disclosure: I'm the author of xlrd]

xlrd allows you to extract data from XLS files. XLSX support is in alpha testing; e-mail me if you need it. You get told precisely what is in each cell (Excel cell type and value). It runs on Python 2.1 to 2.7 on any platform. You don't need Windows. You don't need Excel to be installed on your machine. Start with the tutorial found here.

John Machin