
Introduce setting up a Python environment for office automation, install Python and VS Code, and practice basics like hello world, input, and print within the book series.
Explore Python's numeric data types—integers, floats, booleans, and complex numbers—within the six core data types (number, string, list, tuple, dictionary, set), with hands-on examples and type demonstrations.
Explore Python string type as a list of characters, learn indexing, slicing with start, end, step, and perform operations like join, replace, upper, lower, split, and format with percent.
Learn to create and manipulate Python lists, including nested lists, indexing, slicing, and operations like append, insert, remove, and merge. Explore length, min, max, and sublists in two-dimensional lists.
Explore Python tuples, their immutability compared with lists, and how to define them with parentheses or the tuple keyword, including indexing, slicing, and inner-list mutability.
Explore Python dictionaries: create, access, and modify key-value pairs using dict constructor and curly braces, with get, update, delete, pop, and clear methods, supporting keys of various types (no lists).
Explore Python sets and None type, learn to create sets with set(), distinguish them from dictionaries, and perform intersection, union, and difference while removing duplicates by converting lists to sets.
Learn Python sets through intersection, union, difference, and subset concepts, and master add, update, remove, discard, and clear, plus a brief intro to the None type.
Explore changeable versus non-changeable data types in Python, including lists, dictionaries, sets, tuples, and strings, and learn how assignment affects memory addresses and the idea of light versus deep copy.
Explore copying in Python using the copy module, highlighting light copy and deep copy for nested lists, showing how each affects object addresses and independence.
Examine Python public methods and operators, including mathematical, logical, and assignment operators, plus membership and identity checks (is, is not, in, not in) with examples across tuples, dictionaries, and sets.
Explore Python data structures through traversal and comprehensions, including list, dict, and set comprehensions and generator comprehensions; master for loops, enumerate indexing, and concise, readable code.
Explore Python's three basic programming structures, focusing on the selection structure with if, elif, else, and the ternary operator; learn value validation, list membership checks, and simple list comprehension.
Explore Python looping structures, including while and for loops, with break and continue. Build a number guessing game using range, random, and user input, and learn conditionals and input conversion.
Master the basics of Python functions by defining with def, passing parameters and arguments, and returning values; learn parameter versus argument, default values, and *args and **kwargs with examples.
Master Python function packing and unpacking to return multiple values, pass variable-length arguments, and use star and keyword unpacking in practical examples.
Learn variable scope inside and outside functions, the impact of the global keyword, and how lambda functions enable concise sorting by key.
Explore how Python treats class as a blueprint and object as an instantiated instance, and consider inheritance, polymorphism, and class versus static methods.
Demonstrate private property and private method in a Python class, explain public, protected, and private access with double underscore, and show using getters and setters to interact with private data.
Explore Python magic methods and the object life cycle. Learn __new__, __init__, __del__, and iterable behavior with __iter__ and __next__.
Explore inheritance and polymorphism in Python by defining a person parent class and student and teacher children, showing method overriding and polymorphic calls.
Explore decorators in Python by defining class methods, static methods, and property decorators within a sample person class, illustrating shared class data, instance behavior, and encapsulated access.
Master python exception handling with try/except, use finally, raise and custom exception classes, and leverage ide debugging features and breakpoints.
Learn how to perform file input/output in Python, using open with path, mode, and encoding, and master context managers for reading, writing, and handling JSON data.
Explore Python modules and packages, and structure reusable code with modules and packages. Use pip to install and manage dependencies, and learn import styles and the __name__ guard.
Explore core Python modules for office tasks, including date time, decimal, and OS, with hands-on demos of timestamps, date formatting, decimal precision, and file system operations.
Explore using openpyxl to create, open, and save Excel workbooks in Python, work with worksheets and cells, manage file paths, and automate common Excel tasks.
Get default worksheet
Worksheet properties
Explore managing excel worksheets with python, including loading workbooks by path, listing sheet names with wb.sheet_names, accessing sheets by name, and creating new sheets with create_sheet.
Learn to manage Excel worksheets with openpyxl by creating, deleting, moving, and copying sheets, and saving work to disk.
Access and modify single and multiple cells in excel worksheets using python with the open pi excel library. Learn cell coordinates, row and column indexing, and range selections.
Learn to access Excel cells with Python using worksheet, rows, and columns; iterate to retrieve values, compute average and maximum and minimum temperatures, and save results to a new file.
Merge the cells from B2 to F6 in Excel using Python, explore horizontal and vertical merges, unmerge, and read the merged range coordinates in an openpyxl workflow.
Learn to manipulate Excel workbooks with openpyxl: insert and delete rows or columns, insert data, and move cell ranges with precise parameters.
Learn to use Excel formulas in Python, explore built-in formulas, and apply a translate formula with a translator to automate cross-row calculations in spreadsheets.
Explore configuring Excel styles with Python, including font style, color, size, alignment, height, column width, and effects like border, fill, and gradient, using openpyxl.
Master configuring border style and fill with gradient and pattern fills in openpyxl for Excel, including border sides, colors, and font and alignment context.
Explore how to filter and sort data in Excel with open pi excel and pandas, covering data preparation, auto filter setup, and multi-column sorting.
Learn to insert charts and tables in Excel using Python. Build and customize a line chart by selecting data range, defining series, and adjusting axis titles and styles.
Discover how write-only and read-only modes balance performance and memory usage versus the normal mode that reads and writes. Learn to set write-only for writing and read-only for reading.
Explore protecting Excel workbooks and worksheets with openpyxl, including workbook and worksheet protection and password management, and encrypting opening using pywin32. Learn practical steps and limitations for secure Excel files.
Convert old xls files to xlsx using Python with Win32 COM, validate absolute paths and extensions, and then use openpyxl for further Excel tasks.
Explore the python-docx library to create, open, and save docx documents in Word. Map Word's hierarchy to Python objects and manage paths with os.path.
Learn how to convert a doc to docx in Python using Win32 COM library to drive Word. Confirm absolute paths, ensure Office is installed, and save the document as docx.
Discover how to work with paragraphs in Word using Python and the docx library: create, add, insert, modify, and delete paragraphs, access text, and handle page breaks.
Explore how to set paragraph alignment and apply built-in Word styles using Python and the docx library, including left, center, right, justified, and distributed alignments and built-in style types.
Explore space, indent, and removing paragraph styles in Word using Python, demonstrating how to set space before and after, line spacing, and delete paragraph styles to reset to normal.
Learn to manipulate word documents with Python by working with run objects within a paragraph, adding and clearing runs, and applying font color, size, bold, italic, and underline.
Automate word document generation with Python by using run objects and paragraph styles to create community certificates from Excel data, applying fonts, alignments, and formatting for efficient batch production.
Learn to automate personalized Word certificates from an Excel roster using Python, reading data and filling a template with name, college, major, class, association, year, and date.
Discover how Word uses the EMU as the base unit and convert length across cm, mm, and inch, with demos of Chinese character font mapping and indentation.
Learn how to set a Word title with Python by applying the title style and level, and understand the title and paragraph relationship.
Learn how to insert pictures into Word with python-docx, using add_picture in a paragraph and run workflow, control image size, and place multiple images in the document.
View, delete, and resize pictures in Word documents with Python, treating images as inline shapes and controlling size with explicit units.
Learn to align pictures in Word and implement floating images with python-docx. Retrieve embedded pictures from documents, covering alignment, floating types, and extraction.
Discover how to insert and modify Word tables with Python, creating a table object, adding rows and columns, and manipulating table properties via python-docx in a document.
Learn to manipulate Word tables in Python by creating tables, accessing and editing cell objects, and merging cells, with row and column indexing starting at zero.
Explore creating and styling Word tables with Python, applying cell and paragraph styles, color, and font size, and selecting table styles like grid and colorful grid for polished documents.
Learn to control Word page setup with Python, focusing on sections, section dividers, page size, orientation, margins, and header/footer variations across first, odd, and even pages.
Configure Python page settings by setting orientation per section, swapping width and height for landscape, and adjusting margins (top, bottom, left, right) and gutter.
Learn to manage Word document page settings with Python by configuring header and footer, first page options, odd/even pages, and section-specific layouts.
Explore working with PowerPoint in Python using python-pptx, learning to create and save a presentation, open existing presentations, and manage slides, placeholders, charts, tables, and text.
Explore the unit of length in PowerPoint with Python, covering emu, cm, mm, inch, and point, and demonstrate conversion and usage in pptx and docx libraries.
Explore how to work with PowerPoint slides in Python by inspecting slide layouts, exploring the slide master, adding new slides, and retrieving or deleting slides by index.
Learn to work with shapes in PowerPoint from Python: retrieve, add, and modify shapes such as auto shapes, pictures, frames, groups, lines, and content placeholders, including fill color and borders.
Explore placeholders in PowerPoint slides using Python, learn to identify placeholder types, retrieve their names and indices, and fill placeholders with text or images to build dynamic slides.
Learn to retrieve and add text frames and text boxes in PowerPoint slides using Python, and manipulate text frames, paragraphs, and text properties within shapes.
Learn python-driven PowerPoint text styling, covering paragraph and run levels, alignment, line spacing, fonts, colors, and hyperlinks. Create slides with text frames and text boxes, controlling vertical alignment and wrap.
Learn to create and customize a PowerPoint column chart with Python, including preparing chart data, adding categories and series, configuring axes, legend position, fonts, and basic styling.
learn to create and customize line and scatter charts in PowerPoint using Python PPT, including preparing data, adding series, configuring legends, and noting data table support limitations.
Learn to create a pie chart in PowerPoint with Python, populate categories and a single series, and show percentage data labels with legend positioning.
Create a test PowerPoint file with both chart and table placeholders by customizing the slide master, then insert a pie chart and verify the placeholder types with Python for PowerPoint.
Learn to insert and read tables in PowerPoint with Python, defining rows and columns, positioning on slides, and traversing shapes to extract table data.
Create and test a placeholder table in PowerPoint with Python, load a PPT file, locate table placeholder on slide master, and configure the table frame with rows and columns.
Apply Python to PowerPoint to work with tables, enabling creation, modification, and formatting of table data within slides.
Automate PowerPoint tasks with Python to create, format, and manipulate tables, enhancing productivity in office workflows across slides.
Automate PowerPoint table tasks with Python to create, update, and format tables inside slides, enabling efficient office automation across presentations.
Learn to use Python with PowerPoint to add pictures to slides, enabling automated image insertion and faster, more efficient presentation creation in office workflows.
Apply Python and PyPDF2 to open and save PDFs, create and modify pages, handle encryption and decryption, and convert PDFs to Word or PowerPoint, noting conversion limits.
Learn to work with PDF pages in Python: read and write pages using a PDF reader, writer, and merger, handle deprecated methods, and merge multiple documents.
Explore modifying pdfs by rotating pages with the updated PyPDF2 rotate method, manage odd/even pages, and save rotated outputs while noting zoom, crop, and merge workflows.
Explore how to zoom and crop pdf pages and adjust dimensions with Python's pdf tools, using media box properties and scale tools to modify page size.
Use Python to crop PDF pages by adjusting the media box coordinates, defining a rectangle with lower left and upper right corners to carve out the desired area.
Learn to extract text from PDF pages using pypdf2 and pi mupdf, compare text extraction methods, and explore retrieving images with the page object.
Learn how to extract images from a PDF using PyMuPDF, not PyPDF2, by iterating pages, retrieving image xref, creating pixmaps, and saving as PNGs.
Learn to add a watermark to pdf pages with python by creating a watermark page and merging it with each target page, using pdf reader and writer tools.
Learn to read and update PDF metadata with Python using PyPDF2, accessing author, title, producer, and other document info, and modify metadata for PDF files.
Explore PDF encryption and decryption with Python, using PDF writer and reader to protect documents with a password and decrypt PDFs by traversing pages and writing to a new PDF.
Learn how to convert Word, Excel, and PowerPoint documents to PDF with Python, using docx2pdf for Word and Win32com for Excel and PowerPoint, including batch processing.
Install and use the pdf tool docx to convert PDFs to Word, handling multi-page documents and optional password protection, and validate results.
Explore using Python to merge two PDF files side by side, control layout with horizontal merging, and review basic PDF metadata and options for saving or printing.
This is the self learning the book (in Chinese) 《让Python遇上Office - 从编程入门到自动化办公实践》"When Python Meets Office - From Entry Programming to Office Automation Practice", teach in English language, let you familiar the related Python library dealing with Excel (openpyxl), Word (python-docx), PowerPoint (python-pptx) and PDF (pypdf2 or pypdf3), demo and guide you not only the usage of those libraries, but also practice the actual exercise in those variable office components.
You can buy this book either from online store or read directly from WeChat Read app.
After the course, you'll be confidently choose the right "tool" in proper scenario, and improve your office automation productivity.
The book has 10 chapters in total, divided into 3 parts: The first part (Chapter 1~5) includes the basic knowledge of getting started with Python from scratch (data types, functions, classes and objects, catching exceptions, file operations, management modules, etc.); Chapter 1 The second part (Chapter 6~9) focuses on operating office documents and introduces how to use Python code to process Word, Excel, PPT, and PDF documents to realize document office automation; the third part (Chapter 10) is the advanced part. It involves desktop automation, sending emails, network requests, scheduled tasks, GUI, packaging programs, etc., which can help readers further improve work efficiency.
The course is focusing on show you how to learn by doing! I do hope you can learn new skills as well as feel fun during the journey! Good luck!