[{"data":1,"prerenderedAt":95},["ShallowReactive",2],{"topic:com-automation":3},[4,14,20,26,31,37,42,48,55,61,67,73,79,85,90],{"path":5,"title":6,"description":7,"type":8,"topics":9,"kind":13},"\u002Fautomating-reporting-workflows\u002Ftesting-and-packaging-excel-automation-scripts\u002Ftest-win32com-and-xlwings-code-without-excel","Test win32com and xlwings Code Without Excel","Unit-test Python code that drives Excel through win32com or xlwings on machines without Excel — Linux CI runners, Macs, containers: keep the Excel calls in a thin layer, pass the application in, replace it with small fakes that record what was done, check that workbooks are closed and Excel quit even after errors, stub the win32com import for older code, and keep real-Excel tests for Windows only.","how-to",[10,11,12],"com-automation","xlwings","reliable-jobs",null,{"path":15,"title":16,"description":17,"type":8,"topics":18,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Finserting-images-and-logos-into-excel\u002Fexport-an-excel-chart-as-an-image","Export an Excel Chart as an Image with Python","Turn a chart inside an Excel workbook into a PNG for an email, a slide or a web page — with Excel itself through COM on Windows, with headless LibreOffice on any server plus a Pillow crop, or by redrawing the chart from the same data with matplotlib — and choose by fidelity, platform and resolution.",[19,10],"charts-and-images",{"path":21,"title":22,"description":23,"type":24,"topics":25,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32","Automating Excel with COM and pywin32","Drive a real copy of Excel from Python: attach with win32com, move ranges in one call, run macros and refresh queries, and quit cleanly so no EXCEL.EXE is left behind.","guide",[10],{"path":27,"title":28,"description":29,"type":8,"topics":30,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fautomate-excel-on-macos-with-python","Automate Excel on macOS with Python","pywin32 and COM do not exist on a Mac, so automating Excel there takes different tools: openpyxl and pandas when you only need the file, xlwings when Excel itself must do the work, AppleScript through osascript for the odd task xlwings does not cover — plus the macOS permission prompts, the Excel sandbox file-access dialog, and scheduling with launchd.",[10,11],{"path":32,"title":33,"description":34,"type":8,"topics":35,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fclose-excel-cleanly-and-avoid-orphan-com-processes","Close Excel Cleanly and Avoid Orphan COM Processes","Excel exits only when every reference is released. Learn the try\u002Ffinally shape, CoInitialize on worker threads, and how to detect and kill just the instance you started.",[10,36],"troubleshooting",{"path":38,"title":39,"description":40,"type":8,"topics":41,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fhandle-com-errors-and-excel-dialog-prompts-in-python","Handle COM Errors and Excel Dialog Prompts in Python","Decode pywintypes.com_error through excepinfo, recognise the four HRESULTs that matter, suppress every dialog before opening a file, and add a watchdog for the hangs left over.",[10,36],{"path":43,"title":44,"description":45,"type":8,"topics":46,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fprint-an-excel-workbook-from-python-with-win32com","Print an Excel Workbook from Python with win32com","Send workbooks to a printer from a Python script on Windows: prepare the page setup so the printout is right (fit to width, landscape, repeated header rows, print area) with openpyxl or COM, list printers and pick one, call PrintOut for whole workbooks, single sheets or page ranges, print many files in a loop without dialogs, and fall back to LibreOffice or PDF when Excel is not available.",[10,47],"pdf-export",{"path":49,"title":50,"description":51,"type":8,"topics":52,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fread-and-write-cell-ranges-with-win32com","Read and Write Cell Ranges with win32com","Move data between Python and Excel in single calls: block reads, the nested shape writes require, sizing ranges with End(xlUp), and Value versus Value2.",[10,53,54],"reading-excel","writing-excel",{"path":56,"title":57,"description":58,"type":8,"topics":59,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Frefresh-excel-data-connections-and-recalculate-with-win32com","Refresh Excel Data Connections and Recalculate with win32com","RefreshAll returns before the data arrives. Make refreshes synchronous, recalculate with the right level, refresh pivot caches in order, and verify nothing went stale.",[10,60],"excel-formulas",{"path":62,"title":63,"description":64,"type":8,"topics":65,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Frun-an-excel-macro-from-python-with-win32com","Run an Excel Macro from Python with win32com","Call existing VBA from Python with Application.Run: qualified macro names, positional arguments, return values, and staging bulk data so the loop runs inside Excel.",[66,10],"macros-and-vba",{"path":68,"title":69,"description":70,"type":8,"topics":71,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Frun-excel-com-automation-from-task-scheduler","Run Excel COM Automation from Task Scheduler Without a Logged-In User","Why a pywin32 script that drives Excel works when you run it by hand and fails or hangs from Task Scheduler — session 0, the missing systemprofile Desktop folder, DCOM identity, dialogs nobody can click — and the setups that work, plus how to avoid needing Excel at all.",[10,72,36],"scheduling",{"path":74,"title":75,"description":76,"type":8,"topics":77,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fsave-a-workbook-in-another-format-with-win32com","Save a Workbook in Another Format with win32com","Use Excel itself, through pywin32, to convert workbooks between .xls, .xlsx, .xlsm, .xlsb, CSV, ODS and PDF — the FileFormat codes, SaveAs versus ExportAsFixedFormat, silent overwrites, per-sheet CSV export and folder batch conversion.",[10,78],"file-formats",{"path":80,"title":81,"description":82,"type":8,"topics":83,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fxlwings-vs-pywin32-for-excel-automation","xlwings vs pywin32 for Excel Automation","Both drive the same Excel through the same interface. Compare the code for one task, see what the wrapper adds, and learn when the raw object model is still the better choice.",[84,11,10],"choosing-libraries",{"path":86,"title":87,"description":88,"type":8,"topics":89,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Fhandling-excel-file-formats-and-conversions\u002Fautomate-libreoffice-calc-from-python-with-uno","Automate LibreOffice Calc from Python with UNO","Use LibreOffice as a scriptable spreadsheet engine on any server: start a headless soffice, connect through UNO from Python, open an .xlsx, edit cells, delete rows so that formulas update the way they do in Excel, recalculate, save as .xlsx and export PDF, then shut down cleanly — plus which Python can import uno and how to keep parallel jobs apart.",[78,10],{"path":91,"title":92,"description":93,"type":8,"topics":94,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-win32com-gen-py-attributeerror","Fix the win32com gen_py AttributeError (CLSIDToClassMap)","Excel automation with pywin32 suddenly fails with an AttributeError saying a win32com.gen_py module has no attribute CLSIDToClassMap. The generated type-library cache is broken. Find the gen_py folder, delete just the Excel entry, let EnsureDispatch rebuild it, and stop it happening again on shared and scheduled machines.",[36,10],1790972052271]