Working with Files
Open CSVs, Excel workbooks, folders full of spreadsheets, and write back out. The bread-and-butter file operations.
Toolkit 6 lessons ~55 min
Lessons in this module
- Reading and writing CSV files · 9 min
The csv standard library module and the pandas one-liner equivalents. - Reading Excel files with pandas · 8 min
read_excel: the easiest way to get a .xlsx into Python. - openpyxl — when you need cell-level control · 9 min
Read/write individual cells, formatting, formulas, and styling. The library pandas uses under the hood. - Looping through many files · 8 min
Combine, transform, or report on a whole folder of files in one go. - Text files, JSON, and other formats · 7 min
When you're not dealing with CSV/Excel: plain text, JSON, and a quick note on XML. - Encoding, BOMs, and other file gotchas · 6 min
Why exports from old systems look like garbage, and how to fix them.