Skip to main content

Really lightweight lib for peeking into xlsx column/row size before you try to open the file with something else

Project description

# xlsxmetadata
Really lightweight lib for peeking into xlsx column/row size before you try to open the file with something else

### setup
```pip install xlsxmetadata```

### reading from file...
```python
from xlsxmetadata.metadata import get_dimensions, get_sheet_names

my_big_file = '/path/to/my/real_big_file.xlsx'

sheet_names = get_sheet_names(my_big_file)
print(sheet_names)

>>> {'test_sheet': 1}

dimensions = get_dimensions('/path/to/my/real_big_workbook.xlsx', 'test_sheet')
print(dimensions['end_column'])

>>> 16834

print(dimensions['end_row'])

>>> 1200000
```

### reading from flask form...
```python
from io import BytesIO
from xlsxmetadata.metadata import get_dimensions, get_sheet_names

my_big_file = request.files.get('my_big_file')

sheet_names = get_sheet_names(BytesIO(my_big_file.read()))
print(sheet_names)

>>> {'test_sheet': 1}

# you will probably have to reset the read-head
my_big_file.seek(0)

dimensions = get_dimensions(BytesIO(my_big_file.read()), 'test_sheet')
print(dimensions['end_column'])

>>> 16834

print(dimensions['end_row'])

>>> 1200000
```

This information is stored as metadata in the first few bytes of `.xlsx` files. For some reason no other libraries (xlrd, openpyxl) seem to give the users access to this data directly.

Project details


Download files

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

Source Distribution

xlsxmetadata-0.0.5.tar.gz (2.2 kB view details)

Uploaded Source

File details

Details for the file xlsxmetadata-0.0.5.tar.gz.

File metadata

  • Download URL: xlsxmetadata-0.0.5.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.6

File hashes

Hashes for xlsxmetadata-0.0.5.tar.gz
Algorithm Hash digest
SHA256 29af36783a2a220fe43392b67ff768938151f2bb24a09db68a405444e6715ea7
MD5 07a2410dcafa8b22e20457b3594a8bbc
BLAKE2b-256 f780f61185d6a7492ae72eb47b21d2e52368669418dd70923a27dfd796fd7689

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