# Automate the Boring Stuff has 24 chapters. FDEs need seven

> The seven chapters cover files, Excel, CSV and the web, and they work best read in a deliberate order rather than from front to back.

Original: https://fdetimes.net/en/books-courses/automate-boring-stuff-seven-chapters-fde/

On the book's official site, Al Sweigart writes that the best part of programming is the triumph of seeing the machine do something useful. For an FDE, that moment often arrives in the first week on a customer site: someone sends over a folder full of Excel, PDF and CSV files and asks whether anything can be done with it.

*Automate the Boring Stuff with Python* is now in its third edition, billed as "fully revised" and published by No Starch Press in May 2025. The book can be read free on the official site under a Creative Commons BY-NC-SA 3.0 licence, and the site also links to the print edition from the publisher. The whole book runs to 24 chapters and two appendices.

You do not need to read all of it. Seven chapters deal directly with the first jobs on a deployment: reading files, tidying folders, opening spreadsheets, converting formats and pulling data from the web. A demo never needs any of this; a real deployment cannot avoid it.

## Why a book about "boring stuff" suits FDEs

An agent or a RAG pipeline is only as good as the data fed into it, and customer data rarely sits in a tidy API.

Usually it is an Excel report that accounting exports every month, contracts in PDF and Word, or an internal web portal with no documentation at all. To get to the interesting part, you have to get through this part first.

Sweigart's book teaches exactly that part, through concrete projects rather than theory. So treat the seven chapters below as a first-week toolkit, and read them in order from the foundations up.

| Chapter | Main content | Job on the customer site |
|---|---|---|
| 10. Reading and Writing Files | Paths, reading/writing, the shelve module | Read every file the customer sends, store temporary state |
| 11. Organizing Files | shutil, walking a directory tree, zipfile | Batch-process folders the customer dumps on you |
| 18. CSV, JSON, and XML | Three text formats, removing CSV headers, converting Excel to CSV | Normalise data before loading it into the system |
| 14. Excel Spreadsheets | openpyxl, formulas, freeze panes, charts | Read and edit reports from different departments |
| 15. Google Sheets | Spreadsheets in the cloud | When the customer works in Google Workspace |
| 17. PDF and Word Documents | Office documents | Contracts, procedures, documents for RAG |
| 13. Web Scraping | requests, APIs, Beautiful Soup, Selenium, Playwright | Pull data from web portals with no export |

Chapter 18 comes before chapter 14 on purpose. Once you are used to the idea that CSV, JSON and XML are just plain text, you will see that working with Excel is mostly about getting data out of Excel.

## A worked problem: 40 files from 40 branches

Imagine the customer is a retail chain that sends over 40 Excel sales files, one per branch. They want a single combined table to feed into their analytics system. By hand, you open 40 files, copy 40 times, and are certain to make at least one mistake.

With three chapters from the book, this becomes a short script. Chapter 11 shows how to walk an entire directory tree to collect all 40 files, including those buried in subfolders. Chapter 14 uses openpyxl to read each sheet, and two of its projects, tallying census data and updating a spreadsheet, are almost exactly this kind of problem.

Chapter 18 writes the result to a single CSV file, much like the Excel-to-CSV exercise at the end of the chapter. Put together, the sketch below assumes each file has a header row at the top and its data on the active sheet:

```python
import csv, os, shutil
from pathlib import Path
import openpyxl

SRC = Path('customer_data')

# Step 0: back up the originals before touching any file
shutil.make_archive('original_backup', 'zip', SRC)

with open('combined.csv', 'w', newline='', encoding='utf-8') as out:
    writer = csv.writer(out)
    for folder, _, files in os.walk(SRC):      # chapter 11: walk subfolders too
        for name in files:
            if not name.endswith('.xlsx'):
                continue
            wb = openpyxl.load_workbook(Path(folder) / name, data_only=True)  # chapter 14
            ws = wb.active
            for row in ws.iter_rows(min_row=2, values_only=True):  # skip the header row
                writer.writerow([name, *row])   # chapter 18: add a file-name column
```

The file-name column at the start of each row is a small detail worth keeping. When the customer asks why one branch's figures are off, you can trace the row straight back to its source file instead of reopening all 40.

The first thing to do on a customer site is not to write a loop. Zip up the entire original folder, just as in the backup project in chapter 11, and only then touch any file.

## Three ideas worth keeping

The first comes from chapter 10: Sweigart says to think of a file's contents as a single string, which can run to gigabytes. That is a reminder to ask the customer how large the files are before reading them all into memory. A script that runs fine on a sample file can still crash on a full year's export.

**Key point:** Before changing any of the customer's files, back up the originals.

The second is to back up before any batch operation. Working across a whole directory tree is powerful, and for that very reason it can do damage. A ZIP of the untouched originals is the cheapest way to keep the customer's trust when a script goes wrong.

The last comes from the way chapter 13 orders its tools: requests and an API example come first, then Beautiful Soup, Selenium and Playwright. On a customer site, that order should become a habit: ask whether there is an API or an export button, then parse HTML, and automate a browser only when nothing else works.

## Common mistakes when taking exercises to a customer

The most common mistake is testing a script on two sample files and then running it straight against a full year's export, reading the whole thing into memory. Ask about file size and row counts first, then do a trial run on a small folder.

The second is diving into scraping a web portal when the customer's users already have an export button nobody thought to ask about. One question during customer discovery can save you a week of writing Playwright code.

The last is not reconciling the results. After merging 40 files, the total row count in the CSV must match the sum of the data rows in each file; if it does not, do not send it to the customer.

## Who should read it, and how to put it on your CV

If you already write Python every day, skim chapter 10 and go straight to chapters 11, 18 and 14. If you come from frontend or Java, read all seven chapters carefully in the order of the table above. Chapters 15 and 17 can wait until a customer actually uses Google Sheets or has a pile of contracts.

For your CV, do not write "read Automate the Boring Stuff". Redo one of the exercises on public data, push it to GitHub with a README stating how many files were processed and how much time was saved, then turn that into a one-line achievement.

When an FDE job posting mentions messy customer data or legacy systems, that line shows a recruiter you have done exactly that kind of work.

On a customer site, the first person to turn 40 Excel files into one clean table is often the one trusted with the next piece of work.

**Try this week:**

- Read chapter 11 and write a script that zips a folder before processing any of the files in it
- Run the Excel-to-CSV script from this article on a folder of at least ten Excel files, then reconcile the total row count
- Pick a public website, pull its data with requests first, and switch to Playwright only if that does not work

## Sources

- [Automate the Boring Stuff with Python (official site)](https://automatetheboringstuff.com/)

- [Automate the Boring Stuff with Python, 3rd Ed (No Starch Press)](https://i-programmer.info/book-watch-archive/18069-automate-the-boring-stuff-with-python-3rd-ed-no-starch-press.html)

- [Chapter 14 - Excel Spreadsheets](https://automatetheboringstuff.com/3e/chapter14.html)

- [Chapter 13 - Web Scraping](https://automatetheboringstuff.com/3e/chapter13.html)

- [Chapter 11 - Organizing Files](https://automatetheboringstuff.com/3e/chapter11.html)

- [Chapter 18 - CSV, JSON, and XML Files](https://automatetheboringstuff.com/3e/chapter18.html)

- [Chapter 10 - Reading and Writing Files](https://automatetheboringstuff.com/3e/chapter10.html)
