Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
pyxlsb2
(a variant of pyxlsb - https://github.com/wwwiiilll/pyxlsb) is an Excel 2007+ Binary Workbook (xlsb) parser written in Python.
pyxslb2
offers the following improvements/changes in comparison to pyxlsb:
Download .whl file from the release section
pip install -U [path to whl file]
2. Installing the latest development
Using pip
pip install -U https://github.com/DissectMalware/pyxlsb2/archive/master.zip
Or download the latest version
wget https://github.com/DissectMalware/pyxlsb2/archive/master.zip
Extract the zip file and go to the extracted directory
python setup.py install --user
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.
.. code:: python
from pyxlsb2 import open_workbook with open_workbook('Book1.xlsb') as wb: # Do stuff with wb
The Workbook object exposes a get_sheet_by_index(idx)
and
get_sheet_by_name(name)
method to retrieve Worksheet instances.
.. code:: python
with wb.get_sheet_by_index(0) as sheet: # Do stuff with sheet
with wb.get_sheet_by_name('Sheet1') as sheet: # Do stuff with sheet
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. The
Worksheet object is also directly iterable and is equivalent to calling
rows()
.
.. code:: python
for row in sheet.rows(): print(row)
NOTE: Iterating the same Worksheet instance multiple times in parallel (nested
for
for instance) will yield unexpected results, retrieve more instances
instead.
Note that dates will appear as floats. You must use the convert_date(date)
method from the corresponding Workbook instance to turn them into datetime
.
.. code:: python
print(wb.convert_date(41235.45578))
Converting a workbook to CSV:
.. code:: python
import csv from pyxlsb2 import open_workbook
with open_workbook('Book1.xlsb') as wb: for name in wb.sheets: with wb.get_sheet_by_name(name) as sheet: with open(name + '.csv', 'w') as f: writer = csv.writer(f) for row in sheet.rows(): writer.writerow([c.v for c in row])
Non exhaustive list of things that are currently not supported:
FAQs
Excel 2007+ Binary Workbook (xlsb) parser
We found that pyxlsb2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.