Skip to content

A simple module that reads openpyxl worksheets like Python's native csv DictReader

License

Notifications You must be signed in to change notification settings

foprel/openpyxl-dictreader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A simple module that reads openpyxl worksheets like Python's native csv DictReader

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages