Skip to main content

Unified abstraction for handling xls, xlsx and CSV files in Python

Project description

# TableReader

TableReader is an unified abstraction for handling xls, xlsx and CSV files in Python. It also reads csv tables as unicode on request.

If you are familiar with csv.DictReader from the standard library, think of TableReader as DictReader on steroids.

from tablereader import TableReader

reader = TableReader("some_input.xlsx", sheet="The Data")
for row in reader:
    print row['valuecolumn']

In case you have csv and need unicode support:

reader = TableReader("unicode_input.csv", force_type="unicodecsv")
for row in reader:
    print row['valuecolumn']

If you want to strip out leading and trailing spaces while reading rows, you can:

reader = TableReader("input_with_whitespaces.csv", strip_whitespaces=True)
for row in reader:
    print row['valuecolumn']

And if for some reason you have a file with wrong type by line-ending (commonly found when sharing xls), override auto-detection:

reader = TableReader("wrong_named.xls", force_type="xlsx")
for row in reader:
    print row['valuecolumn']

Sometimes headers are not in the first line. So specify some header row search text and the entire row will be used as column name and all rows after are returned:

from tablereader import OffsetTableReader

reader = OffsetTableReader("wrong_named.xls", "BEGIN_DATA")
for row in reader:
    print row['valuecolumn']

The library has been tested on CPython 2.6, 2.7 and 3.4 as well as PyPy 2.4.1.

Download files

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

Source Distribution

tablereader-1.1.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tablereader-1.1.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

tablereader-1.1.0-py2-none-any.whl (11.7 kB view details)

Uploaded Python 2

File details

Details for the file tablereader-1.1.0.tar.gz.

File metadata

  • Download URL: tablereader-1.1.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tablereader-1.1.0.tar.gz
Algorithm Hash digest
SHA256 b80d4d9b130f5d75b7eb8dd6a7aac452f96b041133a9776f66c15d159c188a6f
MD5 5686f31fddd6950f5e1410da2252465e
BLAKE2b-256 f86c5ab794dfe9b387aeb6c47a628e38615e4b28660627fc668a9b44e5da42fe

See more details on using hashes here.

File details

Details for the file tablereader-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tablereader-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18ed02c6a322817049efe4dca9ab01841720dc2da10fae09c3f68231866ecd74
MD5 12bf95b1d3c5b080f12e26f7838d1106
BLAKE2b-256 991a924fd6b04a289cf1caf0624216a702fa2524f2230ddf24e0b2cbbe8930d6

See more details on using hashes here.

File details

Details for the file tablereader-1.1.0-py2-none-any.whl.

File metadata

File hashes

Hashes for tablereader-1.1.0-py2-none-any.whl
Algorithm Hash digest
SHA256 af3139b64b9fdfb987a591817a06e893340d9c113a7d09e30fd08b768f2cb4a4
MD5 db94e5a026dfe625596b87d4175d9c0a
BLAKE2b-256 2acb6e3a2043c5410790cb8f8cf35066dea1c21259793962370e8ceaf496a7e3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page