Socket
Socket
Sign inDemoInstall

exex

Package Overview
Dependencies
1
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    exex

Extract data from Excel documents.


Maintainers
1

Readme

exex test codecov Code style: black

Extract data from Excel documents

Installation

pip install exex

Usage

Sample Excel file

Load Excel file

from openpyxl import load_workbook
from exex import parse

book = load_workbook("sample.xlsx") # load excel file
sheet = book.active # get active sheet

Single cell by name

parse.values(sheet["A1"])
"name"

Single cell by row/column number

parse.values(sheet.cell(row=1, column=1)) 
"name"

Range of cells

parse.values(sheet["A1":"B2"])
[
  ["name", "abbreviation"],
  ["alpha", "a"],
]

All cells

parse.values(sheet.values)
[
  ["name", "abbreviation", "age"],
  ["alpha", "a", 1],
  ["beta", "b", 2],
  ["gamma", "g", 3],
]

Row by number

parse.values(sheet[1])
["alpha", "a", 1]

Range of rows

parse.values(sheet[1:2])
[
  ["name", "abbreviation", "age"],
  ["alpha", "a", 1],
]

Column by name

parse.values(sheet["A"])
["name", "alpha", "beta", "gamma"]

Rangge of columns

parse.values(sheet["A:B"])
[
  ["name", "alpha", "beta", "gamma"],
  ["abbreviation", "a", "b", "g"],
]

Ways to access sheets

# Sheets
book.sheets[0]                # (sheet) sheet by index
book.sheets["prices"]         # (sheet) sheet by name
book.active                   # (sheet) active sheet

book.sheetnames               # (array) sheet names

Development

Setup

poetry install

Tests (local Python version)

poetry run pytest

Tests (all Python versions defined in tox.ini)

poetry run tox

Code formatting (black)

poetry run black .

Keywords

FAQs


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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc