Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xlsxmetadata

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xlsxmetadata

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

  • 0.0.5
  • PyPI
  • Socket score

Maintainers
1

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...

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...

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.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc