Giter Club home page Giter Club logo

pyxlsb's Introduction

pyxlsb

PyPI

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

Install

pip install pyxlsb

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.

from pyxlsb import open_workbook
with open_workbook('Book1.xlsb') as wb:
    # Do stuff with wb

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

# Using the sheet index (1-based)
with wb.get_sheet(1) as sheet:
    # Do stuff with sheet

# Using the sheet name
with wb.get_sheet('Sheet1') as sheet:
    # Do stuff with sheet

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.

# You can use .rows(sparse=True) to skip empty rows
for row in sheet.rows():
  print(row)
# [Cell(r=0, c=0, v='TEXT'), Cell(r=0, c=1, v=42.1337)]

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

from pyxlsb import convert_date
print(convert_date(41235.45578))
# datetime.datetime(2012, 11, 22, 10, 56, 19)

pyxlsb's People

Contributors

willtrnr avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.