Skip to main content

A simple package to read openpyxl worksheets like a csv DictReader

Project description

openpyxl-dictreader

Description

A module that maps the information in each row in an openpyxl worksheet to a dict whose keys are given by the optional fieldnames parameter, similar to Python's native csv.DictReader.

Installing

pip install openpyxl-dictreader

Examples

Input:

import openpyxl_dictreader

reader = openpyxl_dictreader.DictReader("names.xlsx", "Sheet1")
for row in reader:
    print(row["First Name"], row["Last Name"])

Output:

Boris Johnson
Donald Trump
Mark Rutte

load_workbook keyword arguments

The openpyxl load_workbook method takes several optional keyword arguments. These can be passed into the openpyxl_dictreader.DictReader constructor as keyword arguments:

reader = openpyxl_dictreader.DictReader("names.xlsx", "Sheet1", read_only=False, keep_vba=False, data_only=False, keep_links=True)

Acknowledgements

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

openpyxl-dictreader-0.1.5.tar.gz (2.2 kB view hashes)

Uploaded Source

Built Distribution

openpyxl_dictreader-0.1.5-py3-none-any.whl (2.7 kB view hashes)

Uploaded Python 3

Supported by

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