All guides
The whole site as a reading list. Each track opens with an overview, then works through its guides; every guide has its own step-by-step how-tos underneath.
Know the subject rather than the route? Browse by topic.
Getting Started with Python Excel Automation
Pick a library, read and write workbooks, handle every file format, and drive Excel when you must.
- Automating Excel with COM and pywin32
Show the how-tos
- Add a VBA Macro to a Workbook with xlsxwriter
- Automate Excel on macOS with Python
- Close Excel Cleanly and Avoid Orphan COM Processes
- Extract VBA Macro Code from an Excel File
- Handle COM Errors and Excel Dialog Prompts in Python
- Print an Excel Workbook from Python with win32com
- Read and Write Cell Ranges with win32com
- Refresh Excel Data Connections and Recalculate with win32com
- Run an Excel Macro from Python with win32com
- Run Excel COM Automation from Task Scheduler Without a Logged-In User
- Save a Workbook in Another Format with win32com
- xlwings vs pywin32 for Excel Automation
- Automating Excel With xlwings: The Basics
Show the how-tos
- Call Python from Excel with an xlwings UDF
- Control How xlwings Converts DataFrames and Ranges
- Format Cells in a Live Workbook with xlwings
- Insert a matplotlib Plot into a Live Workbook with xlwings
- Read and Write a Live Excel Workbook with xlwings
- Refresh Excel Pivot Tables and Queries with Python
- Run Python from an Excel Button with xlwings RunPython
- Speed Up xlwings with Bulk Reads and Writes
- Work with Named Ranges and Tables in xlwings
- xlwings: Run a VBA Macro From Python (Example)
- Choosing a Python Excel Library
Show the how-tos
- Benchmark Python Excel Read and Write Speed
- Excel vs CSV vs Parquet for Python Data Pipelines
- Google Sheets vs Excel Files for Python Automation
- Lightweight Python Excel Libraries Compared
- openpyxl vs pandas for Excel Automation
- pandas vs DuckDB for Excel Data
- pandas vs Polars for Excel Workflows
- Pick an Excel Engine for .xlsx, .xlsm, .xls, .xlsb and .ods
- Python vs Office Scripts for Excel Automation
- Python vs Power Automate for Report Workflows
- Python vs Power Query for Cleaning Excel Data
- Python vs VBA for Excel Automation
- Translate Common VBA Macros to Python
- When to Use xlwings Instead of openpyxl
- Handling Excel File Formats and Conversions
Show the how-tos
- Automate LibreOffice Calc from Python with UNO
- Convert an Excel Sheet to a LaTeX Table with Python
- Convert an Excel Sheet to a Markdown Table with Python
- Convert an Excel Sheet to an HTML Table with Python
- Convert an Excel Sheet to JSON with Python
- Convert CSV Files to Excel with Python
- Convert Excel Sheets to YAML or TOML Config
- Convert Fixed-Width Text Files to Excel with pandas
- Convert Word Document Tables to Excel with Python
- Convert .xls to .xlsx with Python
- Convert XML to Excel with pandas read_xml
- Create Calendar Events from an Excel Sheet with Python
- Extract Tables from a PDF into Excel with Python
- Inspect the XML Inside an .xlsx File with Python
- Read an Excel File from a URL or Bytes in Python
- Read and Write .ods Files with Python
- Read Apple Numbers Files in Python
- Read European CSV Exports with Semicolons and Decimal Commas
- Read Excel 2003 XML Spreadsheet Files
- Read Strict Open XML Excel Files in Python
- Read .xls Files in Python with xlrd and pandas
- Read Binary .xlsb Excel Files in Python
- Save a Workbook as an Excel Template with Python
- Work with Macro-Enabled .xlsm Files in openpyxl
- Write CSV Files That Open Correctly in Excel
- Reading Excel Files with Pandas
Show the how-tos
- Handle Merged Cells When Reading Excel with pandas
- How to Read Excel Files With Pandas: A Step-by-Step Guide
- Keep Leading Zeros When Reading Excel with pandas
- List Sheet Names and Column Headers Without Loading the Data
- Read a Cell Range Like B3:F20 into a pandas DataFrame
- Read a Named Range into pandas
- Read an Excel File That Is Open in Excel
- Read Yes/No and TRUE/FALSE Columns as Booleans with pandas
- Read Excel Files Inside a ZIP Archive with Python
- Read Excel Sheets Whose Names Change with pandas
- Read Only Some Rows of an Excel File with pandas
- Read Specific Columns From Excel With Pandas
- Skip Rows and Set the Header When Reading Excel with pandas
- Use Converters When Reading Excel with pandas
- Use Nullable Data Types When Reading Excel with pandas
- Troubleshooting Common Python Excel Errors
Show the how-tos
- Fix "At least one sheet must be visible" in openpyxl and pandas
- Fix BadZipFile When Reading an Excel File in Python
- Fix "ValueError: Cannot convert to Excel" in openpyxl
- Fix "Could Not Convert String to Float" in Excel Data
- Fix the "Data Validation extension is not supported" Warning in openpyxl
- Fix Duplicate Column Names When Reading Excel with pandas
- Fix "Excel does not support datetimes with timezones" in pandas
- Fix "Excel File Format Cannot Be Determined" in pandas
- Fix "Excel Cannot Open the File Because the File Format or Extension Is Not Valid"
- Fix "Excel Found Unreadable Content" After Writing with Python
- Fix "ExcelWriter object has no attribute save" in pandas
- Fix Floating-Point Noise Like 0.1 + 0.2 ≠ 0.3 in Excel Output
- Fix Formula Cells Reading as NaN (or 0) in pandas
- Fix Formulas Showing as Text in Excel Output from Python
- Fix #### Showing Instead of Values in Excel Output
- Fix IllegalCharacterError When Writing Excel with openpyxl
- Fix Invalid Worksheet Name Errors When Writing Excel
- Fix KeyError from Spaces in Excel Column Names
- Fix "Filesize would require ZIP64 extensions" (LargeZipFile) in XlsxWriter
- Fix Long ID Numbers Losing Digits or Turning into 1.23E+18 in Excel
- Fix "MergedCell object attribute value is read-only" in openpyxl
- Fix "Missing optional dependency 'openpyxl'" in pandas
- Fix #NAME? in Formulas Written from Python (XLOOKUP, TEXTJOIN, IFS)
- Fix NoneType Errors When Reading Cells with openpyxl
- Fix "Number Stored as Text" Warnings in Excel Output
- Fix "openpyxl does not support the old .xls file format"
- Fix openpyxl max_row Counting Empty Rows
- Fix openpyxl "TypeError: expected <class ...>"
- Fix openpyxl "Value must be one of" and "Max value is" Errors
- Fix "OverflowError: date value out of range" When Reading Excel
- Fix pandas FutureWarnings in Excel Pipelines
- Fix read_excel Returning an Empty DataFrame
- Fix ReadOnlyWorksheet Has No Attribute Errors in openpyxl
- Fix "Sheet Already Exists" Errors in pandas ExcelWriter
- Fix Text Truncated at 32,767 Characters in Excel Output
- Fix "This sheet is too large" When Writing Excel with pandas
- Fix "Object of type Timestamp is not JSON serializable" When Exporting Excel Data
- Fix UnicodeDecodeError When Reading CSV Files Saved by Excel
- Fix "Unnamed: 0" Columns When Reading Excel with pandas
- Fix "Usecols do not match columns" in pandas read_excel
- Fix "ValueError: I/O operation on closed file" with ExcelWriter
- Fix the win32com gen_py AttributeError (CLSIDToClassMap)
- Fix "Workbook contains no default style" Warning in openpyxl
- Fix "Worksheet Does Not Exist" KeyError in openpyxl
- Fix "Worksheet index 0 is invalid, 0 worksheets found"
- Fix Wrong Sheet Order After Writing with pandas
- Fix "XLRDError: Excel xlsx file; not supported" in Python
- Fix xlsxwriter "Exception caught in workbook destructor"
- Fix XlsxWriter Overwriting an Existing Workbook
- Using openpyxl for Excel File Manipulation
Show the how-tos
- Clear Cell Contents and Formatting with openpyxl
- Convert Excel Column Letters and Numbers in Python
- Copy Cell Styles from One Cell to Another with openpyxl
- Delete Empty Rows and Columns with openpyxl
- Find and Replace Text in Excel with openpyxl
- Find the Last Row with Data in openpyxl
- How openpyxl Stores Python Values: Types, Dates and None
- Insert and Delete Rows and Columns with openpyxl
- Iterate over Rows and Columns with openpyxl
- Merge Repeated Group Labels into Single Cells with openpyxl
- Move a Range of Cells with openpyxl move_range
- openpyxl: Append Data to an Existing Excel Sheet
- Read a Cell Value From Excel With openpyxl
- Read Excel Rows into Dictionaries with openpyxl
- Set the Active Sheet, Selected Cell and Tab Colours with openpyxl
- Set Workbook Properties Like Author and Title with Python
- Transpose a Range of Cells with openpyxl
- Unmerge Cells and Fill the Values with openpyxl
- Use Theme Colours and Tints in openpyxl
- What openpyxl Loses When You Save an Existing Workbook
- Using Python in Excel
Show the how-tos
- Clean Data with pandas in Python in Excel
- Fix Python in Excel Errors
- Forecast a Time Series with Python in Excel
- Get External Data into Python in Excel with Power Query
- Plot Charts with matplotlib in Python in Excel
- Python in Excel vs openpyxl and xlwings
- Reference Cells, Ranges and Tables with xl() in Python in Excel
- Return DataFrames and Values from Python in Excel Cells
- Run a Regression with Python in Excel
- Working with Excel Formulas in Python
Show the how-tos
- Add SUM and AVERAGE Formulas with Python
- Audit Every Formula in a Workbook with Python
- Convert Excel Formulas to Values with Python
- Copy a Formula Down a Column in openpyxl
- Create a Named Range in Excel with openpyxl
- Find External Links and Broken References in a Workbook with Python
- Find #REF!, #DIV/0! and Other Formula Errors in a Workbook
- Handle Circular References and Iterative Calculation in Python
- Map Formula Dependencies in a Workbook with Python
- Read Formula Results with openpyxl data_only
- Recalculate Excel Formulas Without Excel in Python
- Run What-If Scenarios on an Excel Model with Python
- Turn an Excel Model into a Python Function
- Use Structured Table References in Excel Formulas from Python
- Write Dynamic Array Formulas like FILTER and UNIQUE from Python
- Write a Formula to an Excel Cell with openpyxl
- Write Formulas That Reference Other Sheets with openpyxl
- Write Legacy Array Formulas (Ctrl+Shift+Enter) with openpyxl
- Write LET and LAMBDA Formulas from Python
- Write Lookup Formulas (XLOOKUP, VLOOKUP, INDEX/MATCH) with openpyxl
- Working with Multiple Excel Sheets in Python
Show the how-tos
- Apply the Same Change to Every Sheet in a Workbook
- Combine Multiple Excel Files into One in Python
- Copy a Sheet Between Excel Workbooks with Python
- Create a Sheet for Each Group in a DataFrame
- List Every Sheet with Its Size and Visibility
- Merge Workbooks into One File with a Sheet per Source
- Read All Sheets from an Excel File into DataFrames
- Rename, Reorder and Delete Excel Sheets with openpyxl
- Save Each Sheet of a Workbook as a Separate File
- Search Every Sheet and Workbook in a Folder for a Value
- Split One Excel Sheet into Multiple Files by Column Value
- Sum the Same Cell Across Many Sheets with 3D References from Python
- Writing DataFrames to Excel with Pandas
Show the how-tos
- Append a DataFrame to an Existing Excel File with pandas
- Auto-Fit Column Widths When Writing with pandas
- Control How NaN, None and Infinity Appear in Excel Output
- Export a Styled pandas DataFrame to Excel
- How pandas Data Types Are Written to Excel Cells
- openpyxl vs xlsxwriter vs pandas.ExcelWriter
- Round Numbers for Excel Output: float_format vs Number Formats
- Write a DataFrame to a Specific Cell in Excel with pandas
- Write a List of Dictionaries to Excel Without pandas
- Write a MultiIndex DataFrame to Excel with pandas
- Write Clickable Links from a DataFrame Column to Excel
- Write Dates Without the Time Part from pandas to Excel
- Write Excel Formulas from a pandas DataFrame
- Write Grouped Data with Blank Rows Between Groups
- Write a Pandas DataFrame to Excel Without the Index
- Write Very Wide DataFrames to Excel
Advanced Data Transformation and Cleaning for Excel Automation
Clean, validate, join, pivot and reshape spreadsheet data — including sheets built by hand.
- Applying Conditional Formatting With openpyxl
Show the how-tos
- Add Data Bars and Colour Scales with openpyxl
- Add Icon Sets to Excel Cells with openpyxl
- Apply a Colour Scale per Row or per Column with openpyxl
- Apply Conditional Formatting to an Excel Table That Grows
- Control Conditional Formatting Rule Order and Stop If True
- Highlight an Entire Row Based on a Cell Value with openpyxl
- Highlight Blank Cells in Excel with openpyxl
- Highlight Cells Above a Threshold with openpyxl
- Highlight Cells Containing Specific Text with openpyxl
- Highlight Cells with Formula Errors Using Conditional Formatting
- Highlight Differences Between Two Columns with openpyxl
- Highlight Duplicate Values in Excel with openpyxl
- Highlight Overdue Dates in Excel with openpyxl
- Highlight Top and Bottom Values in Excel with openpyxl
- Highlight Values Outside a Tolerance of Target with openpyxl
- Highlight Weekends and Holidays in a Date Column
- List and Remove Conditional Formatting with openpyxl
- Apply Conditional Formatting to a Range in openpyxl
- Use Conditional Formatting Rules That Reference Another Sheet
- Cleaning Excel Data With Pandas: A Production Workflow
Show the how-tos
- Clean Mixed-Currency Amounts into Amount and Currency Columns
- Coalesce Several Excel Columns into One with pandas
- Convert Currency Strings Like "$1,234.56" and "(500)" to Numbers with pandas
- Convert Excel Text Columns to Numbers with pandas
- Convert Percentage Strings Like "12.5%" to Numbers with pandas
- Convert Trailing Minus and CR/DR Amounts with pandas
- Detect Outliers in Excel Data with pandas
- Extract Numbers and Codes from Text with pandas
- Filter Excel Rows by Condition with pandas
- Find Near-Duplicate Names Within One Excel Column
- Fix Garbled Characters Like "Café" and "’" in Excel Data
- Fix the Capitalisation of Names with Exceptions in pandas
- Keep the Latest Record per Key When Deduplicating with pandas
- Map Free-Text Job Titles to Standard Categories
- Normalise Postcodes and ZIP Codes with pandas
- Pandas: Drop Duplicates From an Excel Column
- Remove Accents and Normalise Unicode in Excel Text
- Remove Blank Rows From Excel With Pandas
- Remove Duplicate Words and Extra Punctuation from Text
- Remove Non-Printable Characters from Excel Data with Python
- Reorder Columns to Match a Template Layout with pandas
- Replace Values in an Excel Column with pandas
- Split a Column into Multiple Columns with pandas
- Split an Address Column into Street, City and Postcode
- Split Delimited Cell Values into Rows with pandas
- Split Full Names into First and Last Names with pandas
- Standardise Category Values with a Mapping Table in pandas
- Standardise Country Names and Codes with Python
- Standardise Excel Column Names with pandas
- Standardise Phone Numbers in Excel Data with Python
- Strip Whitespace and Normalise Text Columns with pandas
- Creating Pivot Tables from Excel Data with Pandas
Show the how-tos
- Add a Native Excel Pivot Table with Python
- Add Subtotals and Grand Totals to a pandas Pivot Table
- Bin Values into Ranges Like Excel FREQUENCY with pd.cut
- Build a Cohort Retention Table from Excel Data
- Build a Crosstab from Excel Data with pandas
- Build a Funnel Conversion Table from Event Data
- Build a Product Co-occurrence Matrix from Order Lines
- Build an RFM Customer Segmentation from Excel Data
- Calculate Customer Lifetime Value from Order History
- Calculate Moving Averages with pandas rolling
- Calculate Percent of Total per Group in pandas
- Compare Two Periods Side by Side in a Pivot
- Count Distinct Values per Group in pandas
- Create a Pivot Table from Excel with Pandas
- Export a Pandas Pivot Table to Excel (Formatted)
- Get the Top N Rows per Group in pandas
- Number Rows Within Each Group in pandas
- Pivot Text Values Instead of Numbers in pandas
- Run a Pareto Analysis on Excel Data with pandas
- Run an ABC-XYZ Inventory Classification
- Sort Pivot Rows in a Custom Order with pandas
- Turn a Pivot Table into a Heatmap in Excel
- Unpivot a Wide Excel Sheet with pandas melt
- Use Different Aggregations per Column in a pandas Pivot
- Excel Formula Equivalents in pandas
Show the how-tos
- Approximate-Match VLOOKUP for Tiered Rates in pandas
- AVERAGEIFS, MAXIFS and MINIFS Equivalents in pandas
- CHOOSE, SWITCH and IFS Equivalents in pandas
- CORREL and LINEST Equivalents in Python
- COUNTIF and COUNTIFS Equivalent in pandas
- EOMONTH and EDATE Equivalents in pandas
- EXACT and Case-Sensitive Comparisons in pandas
- Excel IF Formulas as pandas Conditional Columns
- Excel TEXT Function Equivalent in pandas
- Excel Text Functions LEFT, RIGHT, MID and CONCAT in pandas
- FIND, SEARCH and SUBSTITUTE Equivalents in pandas
- FORECAST, TREND, SLOPE and RSQ Equivalents in Python
- FV, PV, RATE and NPER Equivalents in Python
- Goal Seek in Python Instead of Excel
- Excel GROUPBY and PIVOTBY Function Equivalents in pandas
- IFERROR, IFNA, ISNA and ISNUMBER Equivalents in pandas
- INDEX MATCH Equivalent in pandas
- INDIRECT and OFFSET Equivalents in pandas
- IPMT, PPMT, EFFECT and NOMINAL Equivalents in Python
- Match Excel Rounding in pandas
- MEDIAN, MODE and QUARTILE Equivalents in pandas
- PMT, NPV, IRR and XIRR Excel Functions in Python
- RANK and PERCENTILE Formulas in pandas
- REGEXTEST, REGEXEXTRACT and REGEXREPLACE Equivalents in pandas
- Replace Excel Solver with Python
- ROUND, ROUNDUP, MROUND and CEILING Equivalents in Python
- Running Totals and Year-Over-Year Growth in pandas
- SCAN, REDUCE, MAP and BYROW Equivalents in pandas
- SEQUENCE and RANDARRAY Equivalents in Python
- SLN, DB and DDB Depreciation Functions in Python
- STDEV.S, STDEV.P, VAR.S and VAR.P in pandas and NumPy
- SUBTOTAL and AGGREGATE Equivalents in pandas
- SUMIF and SUMIFS Equivalent in pandas
- SUMPRODUCT and Weighted Averages in pandas
- TEXTBEFORE, TEXTAFTER and TEXTSPLIT Equivalents in pandas
- TEXTJOIN Equivalent in pandas (Join Values per Group)
- UNIQUE, SORT and FILTER Equivalents in pandas
- VSTACK, HSTACK, TAKE and CHOOSECOLS Equivalents in pandas
- XIRR and XNPV Equivalents in Python
- XLOOKUP Equivalent in pandas
- XLOOKUP with Multiple Criteria in pandas
- YEARFRAC and DAYS360 Equivalents in Python
- Extracting Data from Messy Excel Sheets
Show the how-tos
- Combine Sheets with Different Layouts into One Table
- Extract Hyperlink URLs from Excel Cells with openpyxl
- Extract Report Header Fields from an Excel Sheet with Python
- Find the Header Row in an Excel Sheet with a Shifting Layout
- Parse Numbers with Units in Excel Cells
- Parse Records That Span Multiple Rows in Excel with pandas
- Read a Calendar-Style Sheet into a Table
- Read an Excel Sheet Where Records Run Across Columns
- Read Cell Colours and Font Styles as Data with openpyxl
- Read Dropdown Lists and Validation Rules from an Existing Workbook
- Read Excel with Multi-Row Headers in pandas
- Read Multiple Tables from One Excel Sheet
- Remove Subtotal and Total Rows from an Excel Export
- Skip Hidden and Filtered Rows When Reading Excel
- Stop Reading at Notes and Footers Below the Data
- Turn a Pivot Table Export Back into Tidy Data
- Handling Missing Data in Excel Reports with Pandas
Show the how-tos
- Drop Rows with Missing Required Fields in pandas
- Fill Gaps in Per-Item Time Series with a Staleness Limit
- Fill Missing Values in Excel with Pandas fillna
- Find and Report Missing Values in an Excel File
- Flag Rows with Too Many Missing Values
- Forward-Fill Blank Cells in Grouped Excel Reports with pandas
- How Missing Values Change Sums, Averages and Counts
- Impute Missing Values by Group with pandas
- Interpolate Missing Numeric Values in Excel Data
- Replace Placeholder Text with NaN in pandas
- Tell Blank Cells, Empty Strings and Zeros Apart in Excel Data
- Visualise Missing Data Patterns in an Excel File
- Merging and Joining Excel DataFrames with Pandas
Show the how-tos
- Append New Rows to a Master Excel File Without Duplicates
- Concatenate Excel Sheets with Different Columns
- Create Every Combination of Two Lists with a Cross Join in pandas
- Find Rows in One Excel File Missing from Another
- Fuzzy Match Names Between Two Excel Files with Python
- Handle Many-to-Many Lookups Without Duplicating Rows
- Join Rows to Effective Date Ranges with pandas
- Look Up All Matches for a Key Instead of the First
- Match Rows by Nearest Date with pandas merge_asof
- Merge Excel Data on Multiple Key Columns with pandas
- Merge Excel Files with Different Column Names in pandas
- Merge More Than Two Excel Files on a Key Column
- Merge on Keys That Differ in Case and Spacing with pandas
- Merge Two Excel Files on a Common Column in Python
- Roll Up Totals Through a Parent-Child Hierarchy
- Update One Excel File from Another with pandas
- Validate a pandas Merge to Avoid Duplicate Rows
- The VLOOKUP Equivalent in pandas for Excel Files
- Moving Data Between Excel and Databases
Show the how-tos
- Cache API Responses When Building Excel Reports
- Compare an Excel File with a Database Table
- Download New Excel Files from an SFTP Server
- Export a Large Database Table to Excel in Chunks
- Export Database Lookup Tables as Excel Dropdown Lists
- Export SQL Query Results to Excel with Python
- Fetch API Data into Excel with Python requests
- Fetch Paginated API Data into Excel
- Generate SQL INSERT Statements from an Excel Sheet
- Load an Excel File into a SQL Database with pandas
- Load Excel Data into MongoDB with Python
- Load Excel into SQLite with a Defined Schema
- Query a Database for IDs Listed in an Excel Sheet
- Query Excel Files with SQL Using DuckDB
- Read Excel Attachments into a Database Nightly
- Refresh an Excel Report from a Database on a Schedule
- Scrape a Web Page Table into Excel with pandas
- Sync Google Sheets with Excel Using Python
- Upsert Excel Rows into a Database Table with Python
- Reading Excel with Polars and Arrow
Show the how-tos
- Clean and Aggregate Excel Data with Polars Expressions
- Clean Wide Excel Sheets with Polars Column Selectors
- Convert Excel Files to Parquet with Python
- Convert pandas Excel Code to Polars
- Fix Schema and Type Errors When Reading Excel with Polars
- Join and Pivot Excel Data with Polars
- Read an Excel File with polars.read_excel
- Read Multiple Excel Sheets with Polars
- Scan and Filter Many Excel Files Lazily with Polars
- Speed Up pandas Excel Reads with the calamine Engine
- Use Polars Window Functions on Excel Data
- Write a Polars DataFrame to Excel with Formatting
- Validating Excel Data with Python
Show the how-tos
- Add Dropdown Data Validation to Excel with openpyxl
- Anonymise Personal Data in an Excel File with Python
- Build a Data Quality Scorecard for an Excel File
- Check Excel Data Types with pandas
- Check References Between Excel Sheets with pandas
- Check That Totals in a Report Add Up
- Compare Two Excel Files for Differences with Python
- Create Dependent Dropdown Lists in Excel with Python
- Detect Possible Duplicate Invoices
- Detect Schema Drift Between Monthly Excel Files
- Find Duplicate Rows in Excel with Python
- Find Gaps in a Numbered Sequence with pandas
- Highlight Invalid Cells in Excel with Python
- Profile an Excel Dataset with pandas
- Reconcile Excel Totals Against Control Totals with Python
- Run a Benford's Law Check on Excel Data
- Validate Check Digits in Excel Data with Python
- Validate Dates Fall Within an Expected Period
- Validate Email and Phone Formats in Excel Data with Python
- Validate Excel Columns Before Import with pandas
- Validate Excel Data with pandera Schemas
- Validate Excel Rows with pydantic Models
- Validate Parent-Child Codes in a Hierarchy
- Working with Dates and Times in Excel Data
Show the how-tos
- Build a 4-4-5 Fiscal Calendar with pandas
- Build a Date Table for Excel Reports with pandas
- Calculate Age and Tenure from Dates with pandas (DATEDIF Equivalent)
- Calculate Business Days Between Excel Dates with pandas
- Calculate Month-to-Date and Year-to-Date Totals with pandas
- Calculate the Nth Weekday of a Month
- Calculate Working Hours Between Two Timestamps
- Convert Excel Time Values and Durations in Python
- Convert Dates Like 20240131, 31.01.24 and 2024031 with pandas
- Convert Text Months and Weekdays to Dates
- Convert Unix Timestamps to Excel Dates with pandas
- Convert Year-Week Codes to Dates with pandas
- Create a Shift Calendar with Rotating Patterns
- Expand Date Ranges into One Row per Day with pandas
- Fill Missing Dates in a Time Series from Excel with pandas
- Find Overlapping Date Ranges with pandas
- Fix Excel Serial Numbers Showing Instead of Dates
- Fix Mixed Day-First and Month-First Dates in Excel Data
- Flag Public Holidays in Excel Data with Python
- Group Excel Data by Fiscal Year and ISO Week with pandas
- Group Excel Rows by Month and Quarter with pandas
- Handle Daylight Saving Time in Excel Timestamps
- Handle the 1904 Date System in Excel Files with Python
- Handle Timezones in Excel Timestamps with Python
- Parse Excel Dates into Python datetimes with pandas
- Resample Irregular Readings to Regular Intervals
- Round Timestamps into Time Slots with pandas
- Working with Large Excel Files in Python
Show the how-tos
- Aggregate a Huge Excel File Without Loading It
- Convert Excel to CSV with Python
- Count Rows in an Excel File Without Loading It
- Find Out Why an Excel File Is Slow to Open
- Process Multiple Excel Files in Parallel with Python
- Read a Large Excel File in Chunks with pandas
- Reduce Memory When Reading Excel with pandas
- Reduce the File Size of an Excel Workbook with Python
- Remove Duplicate Rows Across Many Large Excel Files
- Speed Up openpyxl with read_only Mode
- Split a Large Excel File into Files of N Rows
- Stream Excel Rows into a Database with openpyxl
- Take a Random Sample of Rows from a Large Excel File
- Write Large DataFrames to Excel with write_only Mode
Formatting and Charting Excel Reports with Python
Styles, number formats, tables, charts, images and protection for reports people read.
- Applying Number and Date Formats in Excel
Show the how-tos
- Format Dates in Excel Cells with Python
- Format Durations Over 24 Hours in Excel with Python
- Format Excel Cells as Currency with Python
- Format Fractions and Scientific Notation in Excel
- Format Numbers as Percentages in Excel with Python
- Format Numbers in Lakhs and Crores in Excel
- Format Numbers in Thousands and Millions in Excel with Python
- Format ZIP Codes and IDs with Leading Zeros in Excel
- Localise an Excel Report for Other Languages and Locales
- Read Cell Values as Displayed in Excel with Python
- Show Negative Numbers in Red with Parentheses in Excel
- Show Units Like kg or Hours with Number Formats
- Show Zeros as Dashes or Hide Them in Excel
- Write Custom Number Format Codes in Excel with Python
- Building Excel Reports with xlsxwriter
Show the how-tos
- Add a Chart to an Excel File with xlsxwriter
- Add Sparklines to an Excel Report with xlsxwriter
- Add Text Boxes and Shapes to Excel with XlsxWriter
- Apply Conditional Formatting with xlsxwriter
- Build a Waterfall Chart in Excel with Python
- Combine Chart Types and Chartsheets with XlsxWriter
- Define Names and Protect Sheets with XlsxWriter
- Freeze Panes and Set Zoom with XlsxWriter
- Insert Checkboxes in Excel with xlsxwriter
- Label Chart Points from Cell Values with XlsxWriter
- Set Print Options, Headers and Footers with XlsxWriter
- Store Formula Results with xlsxwriter So Every Viewer Shows Values
- Write a Formatted Excel Report with xlsxwriter
- Write a Million Rows to Excel with xlsxwriter
- Write an Excel Table with Formula Columns Using XlsxWriter
- Write Dates, Times and Durations with XlsxWriter
- Write Rich Text with Mixed Formats in One Cell with xlsxwriter
- Creating Charts in Excel with openpyxl
Show the how-tos
- Add a Combo Chart with a Secondary Axis in openpyxl
- Add a Data Table Below an Excel Chart
- Add a Trendline to an Excel Chart with Python
- Add Error Bars to an Excel Chart with openpyxl
- Add a Line Chart to an Excel Report with Python
- Create a Box and Whisker Chart in Excel with Python
- Create a Bubble Chart in Excel with openpyxl
- Create a Bullet Chart in Excel with Python
- Create a Butterfly Chart in Excel with Python
- Create a Doughnut Chart with openpyxl
- Create a Dumbbell Chart in Excel with Python
- Create a Funnel Chart in Excel with Python
- Create a Gantt Chart in Excel with Python
- Create a Gauge Chart in Excel with Python
- Create a Histogram in Excel with Python
- Create a Pie Chart in Excel with openpyxl
- Create a Radar Chart with openpyxl
- Create a Scatter Chart in Excel with openpyxl
- Create a Slope Chart in Excel with Python
- Create a Stacked Column Chart with openpyxl
- Create a Step Chart in Excel with Python
- Create a Stock Chart with openpyxl
- Create a Waffle or Progress Chart in Excel
- Create an Area Chart in Excel with openpyxl
- Create a Bar Chart in Excel with openpyxl
- Create One Chart per Group with openpyxl
- Format Chart Axes with openpyxl
- Make an Excel Chart Grow with Its Data
- Plot a Chart from Non-Adjacent Columns
- Put a Chart on Its Own Chartsheet with openpyxl
- Shade a Target Band Behind a Line Chart
- Show Negative Bars in a Different Colour
- Style Chart Colours and Data Labels with openpyxl
- Use a Date Axis in an Excel Chart with openpyxl
- Use Multi-Level Category Labels in an Excel Chart
- Creating Excel Tables and Autofilters with Python
Show the how-tos
- Add a Total Row to an Excel Table with Python
- Add an Autofilter to an Excel Sheet with openpyxl
- Add Calculated Columns to an Excel Table with Python
- Append Rows to an Excel Table and Resize It with openpyxl
- Apply Autofilter Criteria and Hide the Filtered Rows with openpyxl
- Choose and Customise Excel Table Styles with Python
- Convert an Excel Table Back to a Normal Range
- Convert Several Ranges into Excel Tables at Once
- Create an Excel Table with Python
- Group and Outline Rows in Excel with openpyxl
- Read an Excel Table by Name into pandas
- Rename and Restyle Existing Excel Tables
- Sort Excel Rows with Python Before Writing
- Inserting Images and Logos into Excel
Show the how-tos
- Add a Watermark to an Excel Sheet with Python
- Add a Logo Image to an Excel Report with openpyxl
- Build a Product Catalog with Images in Excel
- Embed a matplotlib Chart in an Excel Report
- Embed Images Inside Cells with xlsxwriter
- Export an Excel Chart as an Image with Python
- Extract Images from an Excel File with Python
- Generate QR Codes and Barcodes in Excel with Python
- Insert an Image from Memory into Excel with Python
- Render an Excel Range as an Image with Python
- Resize and Position Images in Excel with openpyxl
- Protecting and Sharing Excel Workbooks
Show the how-tos
- Add Comments and Notes to Excel Cells with Python
- Hide Sheets, Rows and Columns with openpyxl
- Let Different People Edit Different Ranges
- Lock Cells and Protect a Sheet with openpyxl
- Make an Excel File Open Read-Only Recommended
- Make an Excel Report Accessible with Python
- Open a Password-Protected Excel File with Python
- Password Protect an Excel File with Python
- Protect Workbook Structure with openpyxl
- Remove Hidden Data Before Sharing an Excel File
- Remove Sheet Protection from a Workbook You Own with openpyxl
- Styling Excel Cells with openpyxl
Show the how-tos
- Add Alternating Row Colors with openpyxl
- Add Borders to a Range with openpyxl
- Add Hyperlinks to Excel Cells with Python
- Apply a Reusable Style Theme Across an Excel Report
- Apply Built-In Cell Styles Like Good, Bad and Neutral
- Apply Gradient and Pattern Fills with openpyxl
- Build a Calendar Sheet in Excel with Python
- Change the Default Font of an Excel Workbook with Python
- Freeze the Header Row in Excel with openpyxl
- Hide Gridlines and Set the Zoom Level with openpyxl
- Indent Cells to Show a Hierarchy with openpyxl
- Insert Page Breaks Between Groups with openpyxl
- Merge Cells and Centre a Report Title with openpyxl
- Rotate Text in Excel Cells with openpyxl
- Set Column Width and Row Height in openpyxl
- Set the Print Area and Page Setup with openpyxl
- Style Whole Columns and Rows Efficiently with openpyxl
- Wrap Text and Align Cells with openpyxl
- Write Rich Text in a Cell with openpyxl
Automating Reporting Workflows with Python and Excel
Templates, dashboards, PDF, email, cloud delivery, scheduling, web apps and testing.
- Automating Excel Online with Microsoft Graph
Show the how-tos
- Add a Chart to an Excel Online Workbook with Microsoft Graph
- Add, Rename and Delete Worksheets with Microsoft Graph
- Append Rows to an Excel Online Table with Microsoft Graph
- Authenticate to Microsoft Graph with MSAL for Excel Automation
- Call Excel Worksheet Functions Through Microsoft Graph
- Copy a Template Workbook in SharePoint with Microsoft Graph
- Create a New Workbook in OneDrive with Microsoft Graph
- Handle Microsoft Graph Throttling in Excel Automation
- Read an Excel File from SharePoint or OneDrive into pandas
- Read and Write Excel Online Ranges with Microsoft Graph
- Recalculate Excel Online Workbooks with Graph Sessions
- Run a Report When an Excel File Changes in OneDrive
- Share an Excel File in OneDrive with a Link Using Graph
- Sort and Filter an Excel Online Table with Microsoft Graph
- Building Finance and Operations Reports in Excel with Python
Show the how-tos
- Allocate Shared Costs Across Departments with Python
- Build a Bank Reconciliation Report with Python and Excel
- Build a Bill of Materials Cost Rollup
- Build a Break-Even Analysis in Excel with Python
- Build a Budget vs Actual Variance Report in Excel with Python
- Build a Capacity Planning Report
- Build a 13-Week Cash Flow Forecast Report in Excel with Python
- Build a Cash Position Report from Bank Statements
- Build a Credit Control Dunning Letter Run
- Build a Customer Churn Report from Subscription Data
- Build a Customer Credit Limit Report
- Build a Customer Profitability Report
- Build a Deferred Revenue Schedule
- Build a Discount Leakage Report
- Build a Fixed Asset Depreciation Schedule with Python
- Build a Fleet Mileage and Fuel Report
- Build a Foreign Exchange Revaluation Report
- Build a Headcount and Attrition Report in Excel with Python
- Build a Lease Liability Schedule
- Build a Loan Amortization Schedule in Excel with Python
- Build a Loan Covenant Compliance Report
- Build a Maintenance Schedule in Excel
- Build a Month-End Close Checklist Tracker
- Build a Monthly KPI Scorecard with Targets
- Build a Price-Volume-Mix Analysis
- Build a Product Margin Report
- Build a Production Yield and Scrap Report
- Build a Profit and Loss Statement from a General Ledger
- Build a Project Budget Burn Report
- Build a Purchase Order Tracking Report
- Build a Returns Analysis Report
- Build a Sales Commission Report with Python and Excel
- Build a Sales Forecast with Exponential Smoothing
- Build a Sales Pipeline Report from a CRM Export
- Build a Staff Utilisation Report from Timesheets
- Build a Supplier Payment Run Proposal
- Build a Supplier Scorecard
- Build a Support Ticket SLA Report
- Build a Training Compliance Matrix
- Build a Trial Balance from a General Ledger
- Build a VAT Return Summary from Transactions
- Build a Warehouse Pick List from Orders
- Build a Warranty Claims Report
- Build a Weekly Sales Report in Excel with Python
- Build a Work in Progress Report for Unbilled Time
- Build an Accounts Receivable Aging Report with Python
- Build an Accruals and Prepayments Schedule
- Build an Aged Creditors Report
- Build an Employee Leave Balance Report
- Build an Energy Consumption Report from Meter Readings
- Build an Intercompany Reconciliation
- Build an Inventory Reorder Report with Python and Excel
- Build an Inventory Turnover and Days on Hand Report
- Build an On-Time Delivery (OTIF) Report with Python
- Build an Overtime Report from Shift Data
- Calculate FIFO Inventory Valuation with Python
- Calculate Weighted Average Cost Inventory Valuation
- Check Supplier Invoices Against Contract Prices
- Compare Supplier Quotes with Python
- Consolidate Employee Expense Claims into a Report
- Consolidate Timesheets from Many Workbooks with Python
- Convert Multi-Currency Transactions with an FX Rate Table
- Generate a Staff Rota in Excel with Python
- Model the Impact of a Price Increase
- Reconcile a Stock Count Against System Inventory
- Reconcile Payroll to the General Ledger
- Send Out Budget Templates and Consolidate the Returns
- Update a Price List with Effective Dates
- Building Multi-Sheet Excel Dashboards
Show the how-tos
- Add a Data Dictionary Sheet to an Excel Report
- Add a KPI Summary Block to an Excel Dashboard
- Add a Table of Contents Sheet with Hyperlinks in Excel
- Add a Dropdown Filter That Drives an Excel Dashboard
- Add a Summary Sheet to an Excel Report with Python
- Add Variance Arrows and Trend Indicators to a Dashboard
- Build a Dashboard Sheet with Charts from Multiple Tabs
- Build a One-Page Executive Summary Sheet
- Build a Rolling 12-Month Chart on an Excel Dashboard
- Lay Out a Dashboard Sheet on a Grid
- Link Dashboard Cells to Data Sheets with Formulas
- Write Multiple DataFrames to One Excel File
- Emailing Excel Reports with smtplib
Show the how-tos
- Attach Multiple Excel Files to One Email in Python
- Download Excel Attachments from an Email Inbox with Python
- Email a Download Link Instead of an Excel Attachment
- Email an Excel Report with an HTML Summary Body
- Embed a Chart Image in the Body of a Report Email
- Personalise Report Emails with Jinja2 Templates
- Queue and Retry Failed Report Emails
- Send a Weekly Digest of Several Reports in One Email
- Send an Excel Report Through Outlook from Python
- Send an Excel Report with Amazon SES
- Send an Excel Report with Gmail from Python
- Send an Excel Report with the Microsoft Graph API
- Send an Excel Report with the SendGrid API
- Send Each Recipient Their Own Excel Report with Python
- Send an Excel Report to Multiple Recipients in Python
- Send Report Emails at Each Recipient's Local Time
- Test Report Emails with a Local SMTP Server
- Zip Large Excel Attachments Before Emailing Them
- Error Handling and Logging in Excel Automation
Show the how-tos
- Detect a Scheduled Report That Did Not Run
- Handle Permission Denied When Writing Excel in Python
- Ignore Excel Lock Files When Processing a Folder
- Log Python Excel Script Output to a File
- Make an Excel Report Job Safe to Rerun
- Prevent Formula Injection in Excel Exports from Python
- Prevent Overlapping Runs of an Excel Report Job
- Quarantine Bad Excel Files in a Batch Job
- Read Untrusted Excel Files Safely in Python
- Retry a Failed Excel Report Job in Python
- Send an Alert When an Excel Report Job Fails
- Set Timeouts on Steps of an Excel Report Job
- Skip a Report Run When the Input File Has Not Changed
- Track Run History and Step Timings of a Report Job
- Validate an Excel Report Before Sending It
- Write Excel Files Atomically in Python
- Exporting Excel Reports to PDF
Show the how-tos
- Add Bookmarks and a Cover Page to an Excel PDF Export
- Add Headers, Footers and Page Numbers to an Excel PDF
- Check a PDF Export for Cut-Off Columns
- Convert an Excel File to PDF with Python
- Convert Excel to PDF on Linux with LibreOffice
- Convert Only Selected Sheets of a Workbook to PDF
- Create a PDF Report from Excel Data with ReportLab
- Export an Excel Report to PDF/A for Archiving
- Fit an Excel Sheet to One Page Wide When Exporting to PDF
- Merge Several Excel PDF Exports into One File
- Password-Protect a PDF Exported from Excel
- Sign a PDF Report Digitally with Python
- Turn PDF Report Pages into Images
- Generating Excel Reports from Templates
Show the how-tos
- Build a Word Report with Tables from Excel Data
- Fill an Excel Template with Python and openpyxl
- Fill PDF Forms from Excel Rows with Python
- Generate an HTML Report from Excel Data with Jinja2
- Generate Customer Account Statements from a Ledger
- Generate Invoices from an Excel Template with Python
- Generate One Excel Report per Region in a Loop
- Generate One PDF per Excel Row
- Generate PowerPoint Slides from Excel Data
- Generate Word Documents from Excel Rows with Python
- Keep Charts and Images When Filling an Excel Template
- Populate an Excel Template Without Losing Formatting
- Print Mailing Labels from an Excel Address List
- Repeat a Template Block for Each Record in an Excel Report
- Replace Placeholders in an Excel Template with Python
- Publishing Excel Reports to Cloud Storage
Show the how-tos
- Name, Version and Archive Generated Excel Reports
- Post an Excel Report to a Slack Channel with Python
- Post an Excel Report to Microsoft Teams with Python
- Read an Excel File Directly from Amazon S3 with pandas
- Save Excel Reports to Google Drive with Python
- Upload an Excel Report over SFTP with Python
- Upload an Excel Report to Amazon S3 with boto3
- Upload an Excel Report to Azure Blob Storage with Python
- Upload an Excel Report to Dropbox with Python
- Upload an Excel Report to Google Cloud Storage
- Upload an Excel Report to SharePoint with Python
- Write Excel Files to a Network Share from Python
- Scheduling Python Excel Scripts with Cron
Show the how-tos
- Backfill Excel Reports for Past Dates with Python
- Choose a Scheduler for Python Excel Reports
- Orchestrate Excel Reports with Apache Airflow
- Orchestrate Excel Reports with Dagster
- Orchestrate Excel Reports with Prefect
- Run a Python Excel Report in Docker
- Run a Python Excel Report in GitHub Actions
- Run a Report on the Last Business Day of the Month
- Run an Excel Report as a Kubernetes CronJob
- Run a Python Excel Report in AWS Lambda
- Run an Excel Report in Azure Functions
- Run an Excel Report on Google Cloud Run Jobs
- Run a Python Excel Script on Windows Task Scheduler
- Schedule a Python Excel Script on macOS with launchd
- Schedule an Excel Report with systemd Timers
- Schedule Excel Reports with Celery Beat
- Schedule Recurring Excel Reports with APScheduler
- Schedule Reports Correctly Across Time Zones and DST
- Trigger an Excel Report from a Webhook
- Wait for Upstream Data Before Running a Report
- Watch a Folder and Process New Excel Files with Python
- Serving Excel Files from Python Web Apps
Show the how-tos
- Add an Export to Excel Action in Django Admin
- Build a Gradio App That Cleans an Uploaded Excel File
- Build a Streamlit App to Upload and Download Excel Files
- Build an Excel Workbook in Memory with BytesIO
- Cache Generated Excel Files in a Web App
- Download an Excel File from a Dash App
- Export a Django Queryset to Excel
- Generate Large Excel Exports in a Background Job
- Handle an Uploaded Excel File in Flask and FastAPI
- Import an Excel File into Django Models
- Return an Excel File from a Flask Download Endpoint
- Return an Excel File from AWS Lambda Through API Gateway
- Stream an Excel File from a FastAPI Endpoint
- Validate an Uploaded Excel File Before Processing It in a Web App
- Testing and Packaging Excel Automation Scripts
Show the how-tos
- Block Large or Sensitive Excel Files with a Pre-commit Hook
- Build a Command-Line Tool for Excel Reports with argparse
- Compare Excel Output to a Golden File in Tests
- Create Excel Test Fixtures in Memory for pytest
- Diff Excel Files in Git with a textconv Driver
- Generate Realistic Test Data for Excel Reports with Faker
- Keep Excel Report Settings in a Config File
- Make Excel Output Reproducible in Python
- Package a Python Excel Script as an EXE with PyInstaller
- Profile a Slow Excel Report Script in Python
- Set Up an Excel Automation Project with uv
- Store Credentials for Excel Report Scripts Safely
- Store Excel Files in Git with Git LFS
- Test Excel Cleaning Code with Hypothesis
- Test Excel Code Against Several Library Versions with nox
- Test Excel Output with pytest
- Test That Excel Charts Were Written Correctly
- Test win32com and xlwings Code Without Excel
- Lint and Type-Check an Excel Automation Project