calmccaffrey / BIFFY

BIFFY is an Excel 2007-2010 Binary Workbook (XLSB / BIFF12) parser for Python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BIFFY

BIFFY is an Excel 2007-2010 Binary Workbook (XLSB / BIFF12) parser for Python. The library is currently extremely limited, but functional enough for basic data extraction.

Usage

The module exposes an open_workbook(name) method (similar to Xlrd and OpenPyXl) for opening XLSB files. The Workbook object representing the file is returned.

import biffy
wb = biffy.open_workbook('workbook.xlsb')

The Workbook object exposes a get_sheet(idx) method for retrieving a Worksheet instance.

# Using the sheet index (1-based)
sheet = wb.get_sheet(1)

# Using the sheet name
sheet = wb.get_sheet('Sheet1')

Tip: A sheets property containing the sheet names is available on the Workbook instance.

The rows() method will hand out an iterator to read the worksheet rows.

for row in sheet.rows():
  print row

Do note that dates will appear as floats. You must use the convert_date(date) method from the biffy module to turn them into datetime instances.

print biffy.convert_date(41235.45578)

Install

Download or checkout the repository and run the setup.py script as usual.

python setup.py install

About

BIFFY is an Excel 2007-2010 Binary Workbook (XLSB / BIFF12) parser for Python.


Languages

Language:Python 100.0%