Skip to content

Sync openpyxl-excel-spreadsheets-python with the updated tutorial - #970

Merged
realpython-bot merged 2 commits into
masterfrom
maintenance/openpyxl-excel-spreadsheets-python-20261201
Dec 1, 2026
Merged

realpython-bot merged 2 commits into
masterfrom
maintenance/openpyxl-excel-spreadsheets-python-20261201

Conversation

@realpython-bot

Copy link
Copy Markdown
Collaborator

Adds the sample code for A Guide to Excel Spreadsheets in Python With openpyxl to the existing openpyxl-excel-spreadsheets-python/ folder, which so far held only the reviews-sample.xlsx dataset.

Under the standing rule, every tutorial that ships runnable code gets its code in a materials folder, plus a sample-code opt-in. The scripts mirror the update draft, one per tutorial section:

  • hello_world.py, append_data.py: creating and appending to a spreadsheet
  • reading.py, iterating.py, products_dict.py: reading and iterating through the dataset
  • classes.py, mapping.py, parse_reviews.py: rows into data classes
  • cells_rows_columns.py, managing_sheets.py: basic operations (REPL sessions turned into scripts)
  • freeze_and_filter.py, formulas.py, styles.py, conditional_formatting.py
  • add_image.py, bar_chart.py, line_chart.py
  • db_classes.py, export_classes.py: data classes to a spreadsheet with a chart
  • pandas_to_excel.py, excel_to_pandas.py
  • requirements.txt pins openpyxl==3.1.5, pandas==3.1.0, Pillow==13.0.0, matching the draft's dependencies field; the README states the minimum-python==3.11 floor

The scripts read reviews-sample.xlsx (the file the tutorial calls sample.xlsx), so they run out of the box. The dataset is unchanged.

Links:

How it was verified:

  • Python 3.15.2 venv on the pinned requirements: all 18 runnable scripts exit 0 (add_image.py with a stand-in logo.png). products_dict.py reports 98 products, parse_reviews.py prints the Product(id='B00FALQ1ZC', parent=937001370, ...) / Review(id='R3O9SGZBVQBV76', customer_id=3653882, ...) pair, and excel_to_pandas.py prints the Index([...], dtype='str'), the first 10 star ratings, and the R2EQL1V1L6E0C9 row as the article shows them.
  • ruff@0.14.1 format --check, ruff check, and dircheck.py are clean.

Note: the dataset's sheet is titled amazon_reviews_us_Watches_v1_00-sample, while the article's REPL output shows 'Sheet 1'. That's a gap in the article, not in this folder, so this PR doesn't change it.

🤖 Generated with Claude Code

@realpython-bot
realpython-bot merged commit b072cb4 into master Dec 1, 2026
1 check passed
@realpython-bot
realpython-bot deleted the maintenance/openpyxl-excel-spreadsheets-python-20261201 branch December 1, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant