[{"data":1,"prerenderedAt":2488},["ShallowReactive",2],{"doc:\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fsave-a-workbook-in-another-format-with-win32com":3,"surround:\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fsave-a-workbook-in-another-format-with-win32com":2456,"ancestors:\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fsave-a-workbook-in-another-format-with-win32com":2464,"children:\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fsave-a-workbook-in-another-format-with-win32com":2469,"related:\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fsave-a-workbook-in-another-format-with-win32com":2470},{"id":4,"title":5,"body":6,"dateModified":2423,"datePublished":2423,"description":2424,"extension":2425,"faq":2426,"keyword":2435,"kind":2436,"meta":2437,"navigation":328,"path":2445,"seo":2446,"slug":2449,"stem":2450,"topics":2451,"type":2454,"__hash__":2455},"docs\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fsave-a-workbook-in-another-format-with-win32com\u002Findex.md","Save a Workbook in Another Format with win32com",{"type":7,"value":8,"toc":2409},"minimark",[9,41,253,258,261,286,289,293,300,439,457,461,471,781,794,999,1014,1018,1034,1208,1215,1219,1229,1491,1498,1502,1505,1778,1795,1932,1936,1942,2248,2262,2266,2301,2305,2315,2319,2344,2348,2354,2360,2366,2372,2376,2405],[10,11,12,13,17,18,22,23,26,27,30,31,34,35,40],"p",{},"pandas and openpyxl convert ",[14,15,16],"em",{},"data"," between formats, but they cannot write ",[19,20,21],"code",{},".xlsb"," or legacy ",[19,24,25],{},".xls",", and a round trip through them drops charts, macros and much of the formatting. When you need a faithful conversion — the same workbook, a different container — the most reliable converter is Excel itself. On a Windows machine with Excel installed, pywin32 lets Python open a workbook in Excel and call ",[19,28,29],{},"SaveAs"," with any format Excel supports, or ",[19,32,33],{},"ExportAsFixedFormat"," for PDF. This guide, part of ",[36,37,39],"a",{"href":38},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002F","Automating Excel with COM and pywin32",", covers the format codes, the switches that keep Excel from stopping to ask questions, and batch conversion of whole folders.",[42,43,51,52,51,56,51,60,51,68,51,78,51,89,51,96,51,101,51,109,51,116,51,122,51,127,51,130,51,135,51,144,51,149,51,152,51,157,51,161,51,165,51,168,51,171,51,176,51,183,51,187,51,191,51,194,51,197,51,200,51,206,51,210,51,214,51,217,51,220,51,225,51,232,51,237,51,241,51,244,51,247],"svg",{"viewBox":44,"role":45,"ariaLabelledBy":46,"xmlns":49,"style":50},"4 0 752 566","img",[47,48],"com-formats-t","com-formats-d","http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg","width:100%;max-width:752px;height:auto;display:block;margin:1.5rem auto;font-family:Inter,ui-sans-serif,system-ui,sans-serif","\n  ",[53,54,55],"title",{"id":47},"One workbook saved into many formats by Excel through COM",[57,58,59],"desc",{"id":48},"Python opens a workbook in Excel through pywin32, then calls SaveAs with a FileFormat code to produce xlsx, xlsm, xlsb, legacy xls, CSV UTF-8 or ODS, or ExportAsFixedFormat to produce PDF.",[61,62],"rect",{"x":63,"y":64,"width":65,"height":66,"fill":67},"4","0","752","566","#ffffff",[61,69],{"x":70,"y":71,"width":72,"height":73,"rx":74,"fill":75,"stroke":76,"style":77},"20.0","223.5","220.0","93.0","12","#f0f4ff","var(--brand,#5b5cf0)","stroke-width:2px",[79,80,82],"g",{"transform":81},"translate(118.0,236.5) scale(1.000)",[83,84],"path",{"d":85,"fill":86,"stroke":87,"style":88},"M3 5.5l8-1.2v7.2H3z M13 4l8-1.2v8.7h-8z M3 13.5h8v7.2l-8-1.2z M13 13.5h8v8.7l-8-1.2z","none","var(--brand-strong,#4338ca)","stroke-width:1.80px;stroke-linecap:round;stroke-linejoin:round",[90,91,95],"text",{"x":92,"y":93,"style":94},"130.0","283.0","font-size:13.5px;font-weight:700;fill:var(--brand-strong,#4338ca);text-anchor:middle","source workbook",[90,97,100],{"x":92,"y":98,"style":99},"302.5","font-size:11.5px;font-weight:400;fill:var(--text,#172033);text-anchor:middle","opened in Excel via COM",[61,102],{"x":103,"y":104,"width":105,"height":106,"rx":74,"fill":107,"stroke":108,"style":77},"490.0","16.0","250.0","92.0","#d9f4f1","var(--teal,#0f9488)",[79,110,112],{"transform":111},"translate(603.0,29.0) scale(1.000)",[83,113],{"d":114,"fill":86,"stroke":115,"style":88},"M6 3h9l4 4v14H6z M15 3v4h4 M9.5 11.5l4.5 6 M14 11.5l-4.5 6","var(--teal-ink,#0b6157)",[90,117,121],{"x":118,"y":119,"style":120},"615.0","75.0","font-size:13px;font-weight:700;fill:var(--teal-ink,#0b6157);text-anchor:middle",".xlsx",[90,123,126],{"x":118,"y":124,"style":125},"94.0","font-size:11px;font-weight:400;fill:var(--text,#172033);text-anchor:middle","FileFormat 51",[83,128],{"d":129,"fill":86,"stroke":76,"style":77},"M244.0,270.0 C364.0,270.0 364.0,62.0 480.0,62.0",[131,132],"polygon",{"points":133,"fill":134},"484.0,62.0 475.0,67.0 475.0,57.0","#5b5cf0",[61,136],{"x":137,"y":138,"width":139,"height":140,"rx":141,"fill":67,"stroke":142,"style":143},"337.4","156.0","55.2","19.0","9","var(--line,#cdd5e6)","stroke-width:1px",[90,145,29],{"x":146,"y":147,"style":148},"365.0","169.5","font-size:10.5px;font-weight:700;fill:var(--muted,#5b6780);text-anchor:middle",[61,150],{"x":103,"y":151,"width":105,"height":106,"rx":74,"fill":107,"stroke":108,"style":77},"120.0",[79,153,155],{"transform":154},"translate(603.0,133.0) scale(1.000)",[83,156],{"d":114,"fill":86,"stroke":115,"style":88},[90,158,160],{"x":118,"y":159,"style":120},"179.0",".xlsm \u002F .xlsb",[90,162,164],{"x":118,"y":163,"style":125},"198.0","52 \u002F 50",[83,166],{"d":167,"fill":86,"stroke":76,"style":77},"M244.0,270.0 C364.0,270.0 364.0,166.0 480.0,166.0",[131,169],{"points":170,"fill":134},"484.0,166.0 475.0,171.0 475.0,161.0",[61,172],{"x":103,"y":173,"width":105,"height":106,"rx":74,"fill":174,"stroke":175,"style":77},"224.0","#fdefd8","var(--gold,#b4740a)",[79,177,179],{"transform":178},"translate(603.0,237.0) scale(1.000)",[83,180],{"d":181,"fill":86,"stroke":182,"style":88},"M6 3h9l4 4v14H6z M15 3v4h4","var(--gold-ink,#7a4e06)",[90,184,186],{"x":118,"y":93,"style":185},"font-size:13px;font-weight:700;fill:var(--gold-ink,#7a4e06);text-anchor:middle",".xls (97-2003)",[90,188,190],{"x":118,"y":189,"style":125},"302.0","FileFormat 56",[83,192],{"d":193,"fill":86,"stroke":76,"style":77},"M244.0,270.0 C364.0,270.0 364.0,270.0 480.0,270.0",[131,195],{"points":196,"fill":134},"484.0,270.0 475.0,275.0 475.0,265.0",[61,198],{"x":103,"y":199,"width":105,"height":106,"rx":74,"fill":174,"stroke":175,"style":77},"328.0",[79,201,203],{"transform":202},"translate(603.0,341.0) scale(1.000)",[83,204],{"d":205,"fill":86,"stroke":182,"style":88},"M3 5h18v14H3z M3 10h18 M3 15h18 M9 5v14",[90,207,209],{"x":118,"y":208,"style":185},"387.0","CSV UTF-8",[90,211,213],{"x":118,"y":212,"style":125},"406.0","62 — active sheet only",[83,215],{"d":216,"fill":86,"stroke":76,"style":77},"M244.0,270.0 C364.0,270.0 364.0,374.0 480.0,374.0",[131,218],{"points":219,"fill":134},"484.0,374.0 475.0,379.0 475.0,369.0",[61,221],{"x":103,"y":222,"width":105,"height":106,"rx":74,"fill":223,"stroke":224,"style":77},"432.0","#fee8f2","var(--accent,#f43f8f)",[79,226,228],{"transform":227},"translate(603.0,445.0) scale(1.000)",[83,229],{"d":230,"fill":86,"stroke":231,"style":88},"M6 3h9l4 4v14H6z M15 3v4h4 M9 12h6 M9 15.5h6 M9 19h4","var(--accent-ink,#be185d)",[90,233,236],{"x":118,"y":234,"style":235},"491.0","font-size:13px;font-weight:700;fill:var(--accent-ink,#be185d);text-anchor:middle","PDF",[90,238,240],{"x":118,"y":239,"style":125},"510.0","ExportAsFixedFormat(0)",[83,242],{"d":243,"fill":86,"stroke":76,"style":77},"M244.0,270.0 C364.0,270.0 364.0,478.0 480.0,478.0",[131,245],{"points":246,"fill":134},"484.0,478.0 475.0,483.0 475.0,473.0",[90,248,252],{"x":249,"y":250,"style":251},"380.0","546.0","font-size:12.5px;font-weight:400;fill:var(--muted,#5b6780);text-anchor:middle","Excel does the conversion, so formatting, charts and macros survive where the target format allows",[254,255,257],"h2",{"id":256},"prerequisites","Prerequisites",[10,259,260],{},"Windows, a desktop installation of Excel, and pywin32:",[262,263,268],"pre",{"className":264,"code":265,"language":266,"meta":267,"style":267},"language-bash shiki shiki-themes github-light github-dark-high-contrast","pip install pywin32\n","bash","",[19,269,270],{"__ignoreMap":267},[271,272,275,279,283],"span",{"class":273,"line":274},"line",1,[271,276,278],{"class":277},"sMTad","pip",[271,280,282],{"class":281},"srMev"," install",[271,284,285],{"class":281}," pywin32\n",[10,287,288],{},"COM needs absolute paths — Excel's working directory is not your script's — so every example resolves paths first.",[254,290,292],{"id":291},"step-1-open-excel-safely","Step 1 — Open Excel safely",[10,294,295,296,299],{},"Start a private Excel instance, make it quiet, and guarantee it quits whatever happens. ",[19,297,298],{},"DispatchEx"," starts a new process rather than attaching to one the user has open, so your automation never touches their workbooks:",[262,301,305],{"className":302,"code":303,"language":304,"meta":267,"style":267},"language-python shiki shiki-themes github-light github-dark-high-contrast","from pathlib import Path\n\nimport win32com.client as win32\n\ndef start_excel():\n    excel = win32.DispatchEx(\"Excel.Application\")\n    excel.Visible = False\n    excel.DisplayAlerts = False      # no \"file exists, replace?\" prompts\n    excel.ScreenUpdating = False\n    excel.EnableEvents = False       # do not run workbook event macros\n    return excel\n","python",[19,306,307,323,330,344,349,362,380,392,407,417,430],{"__ignoreMap":267},[271,308,309,313,317,320],{"class":273,"line":274},[271,310,312],{"class":311},"s-kum","from",[271,314,316],{"class":315},"skGVy"," pathlib ",[271,318,319],{"class":311},"import",[271,321,322],{"class":315}," Path\n",[271,324,326],{"class":273,"line":325},2,[271,327,329],{"emptyLinePlaceholder":328},true,"\n",[271,331,333,335,338,341],{"class":273,"line":332},3,[271,334,319],{"class":311},[271,336,337],{"class":315}," win32com.client ",[271,339,340],{"class":311},"as",[271,342,343],{"class":315}," win32\n",[271,345,347],{"class":273,"line":346},4,[271,348,329],{"emptyLinePlaceholder":328},[271,350,352,355,359],{"class":273,"line":351},5,[271,353,354],{"class":311},"def",[271,356,358],{"class":357},"s_Opv"," start_excel",[271,360,361],{"class":315},"():\n",[271,363,365,368,371,374,377],{"class":273,"line":364},6,[271,366,367],{"class":315},"    excel ",[271,369,370],{"class":311},"=",[271,372,373],{"class":315}," win32.DispatchEx(",[271,375,376],{"class":281},"\"Excel.Application\"",[271,378,379],{"class":315},")\n",[271,381,383,386,388],{"class":273,"line":382},7,[271,384,385],{"class":315},"    excel.Visible ",[271,387,370],{"class":311},[271,389,391],{"class":390},"sP0c6"," False\n",[271,393,395,398,400,403],{"class":273,"line":394},8,[271,396,397],{"class":315},"    excel.DisplayAlerts ",[271,399,370],{"class":311},[271,401,402],{"class":390}," False",[271,404,406],{"class":405},"s-wDw","      # no \"file exists, replace?\" prompts\n",[271,408,410,413,415],{"class":273,"line":409},9,[271,411,412],{"class":315},"    excel.ScreenUpdating ",[271,414,370],{"class":311},[271,416,391],{"class":390},[271,418,420,423,425,427],{"class":273,"line":419},10,[271,421,422],{"class":315},"    excel.EnableEvents ",[271,424,370],{"class":311},[271,426,402],{"class":390},[271,428,429],{"class":405},"       # do not run workbook event macros\n",[271,431,433,436],{"class":273,"line":432},11,[271,434,435],{"class":311},"    return",[271,437,438],{"class":315}," excel\n",[10,440,441,444,445,447,448,451,452,456],{},[19,442,443],{},"DisplayAlerts = False"," is essential for unattended runs: without it, the first ",[19,446,29],{}," over an existing file opens a dialog nobody can answer and the script hangs. The cleanup side of this pattern, including orphaned ",[19,449,450],{},"EXCEL.EXE"," processes, is covered in ",[36,453,455],{"href":454},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fclose-excel-cleanly-and-avoid-orphan-com-processes\u002F","Close Excel Cleanly and Avoid Orphan COM Processes",".",[254,458,460],{"id":459},"step-2-saveas-with-a-fileformat-code","Step 2 — SaveAs with a FileFormat code",[10,462,463,466,467,470],{},[19,464,465],{},"Workbook.SaveAs(Filename, FileFormat)"," writes a copy in the format given by an ",[19,468,469],{},"XlFileFormat"," code. Keep the codes in one mapping keyed by extension, so the target file name decides the format:",[262,472,474],{"className":302,"code":473,"language":304,"meta":267,"style":267},"FILE_FORMATS = {\n    \".xlsx\": 51,   # xlOpenXMLWorkbook\n    \".xlsm\": 52,   # xlOpenXMLWorkbookMacroEnabled\n    \".xlsb\": 50,   # xlExcel12 (binary)\n    \".xls\": 56,    # xlExcel8 (97-2003)\n    \".csv\": 62,    # xlCSVUTF8\n    \".ods\": 60,    # xlOpenDocumentSpreadsheet\n}\n\ndef convert(src: str, dst: str) -> None:\n    src_path, dst_path = Path(src).resolve(), Path(dst).resolve()\n    fmt = FILE_FORMATS[dst_path.suffix.lower()]\n    excel = start_excel()\n    try:\n        wb = excel.Workbooks.Open(str(src_path), UpdateLinks=0, ReadOnly=True)\n        try:\n            wb.SaveAs(str(dst_path), FileFormat=fmt)\n        finally:\n            wb.Close(SaveChanges=False)\n    finally:\n        excel.Quit()\n\nconvert(\"reports\u002Fq3.xlsx\", \"reports\u002Fq3.xlsb\")\n",[19,475,476,487,504,519,534,550,565,580,585,589,616,626,640,650,658,695,703,722,730,746,754,760,765],{"__ignoreMap":267},[271,477,478,481,484],{"class":273,"line":274},[271,479,480],{"class":390},"FILE_FORMATS",[271,482,483],{"class":311}," =",[271,485,486],{"class":315}," {\n",[271,488,489,492,495,498,501],{"class":273,"line":325},[271,490,491],{"class":281},"    \".xlsx\"",[271,493,494],{"class":315},": ",[271,496,497],{"class":390},"51",[271,499,500],{"class":315},",   ",[271,502,503],{"class":405},"# xlOpenXMLWorkbook\n",[271,505,506,509,511,514,516],{"class":273,"line":332},[271,507,508],{"class":281},"    \".xlsm\"",[271,510,494],{"class":315},[271,512,513],{"class":390},"52",[271,515,500],{"class":315},[271,517,518],{"class":405},"# xlOpenXMLWorkbookMacroEnabled\n",[271,520,521,524,526,529,531],{"class":273,"line":346},[271,522,523],{"class":281},"    \".xlsb\"",[271,525,494],{"class":315},[271,527,528],{"class":390},"50",[271,530,500],{"class":315},[271,532,533],{"class":405},"# xlExcel12 (binary)\n",[271,535,536,539,541,544,547],{"class":273,"line":351},[271,537,538],{"class":281},"    \".xls\"",[271,540,494],{"class":315},[271,542,543],{"class":390},"56",[271,545,546],{"class":315},",    ",[271,548,549],{"class":405},"# xlExcel8 (97-2003)\n",[271,551,552,555,557,560,562],{"class":273,"line":364},[271,553,554],{"class":281},"    \".csv\"",[271,556,494],{"class":315},[271,558,559],{"class":390},"62",[271,561,546],{"class":315},[271,563,564],{"class":405},"# xlCSVUTF8\n",[271,566,567,570,572,575,577],{"class":273,"line":382},[271,568,569],{"class":281},"    \".ods\"",[271,571,494],{"class":315},[271,573,574],{"class":390},"60",[271,576,546],{"class":315},[271,578,579],{"class":405},"# xlOpenDocumentSpreadsheet\n",[271,581,582],{"class":273,"line":394},[271,583,584],{"class":315},"}\n",[271,586,587],{"class":273,"line":409},[271,588,329],{"emptyLinePlaceholder":328},[271,590,591,593,596,599,602,605,607,610,613],{"class":273,"line":419},[271,592,354],{"class":311},[271,594,595],{"class":357}," convert",[271,597,598],{"class":315},"(src: ",[271,600,601],{"class":390},"str",[271,603,604],{"class":315},", dst: ",[271,606,601],{"class":390},[271,608,609],{"class":315},") -> ",[271,611,612],{"class":390},"None",[271,614,615],{"class":315},":\n",[271,617,618,621,623],{"class":273,"line":432},[271,619,620],{"class":315},"    src_path, dst_path ",[271,622,370],{"class":311},[271,624,625],{"class":315}," Path(src).resolve(), Path(dst).resolve()\n",[271,627,629,632,634,637],{"class":273,"line":628},12,[271,630,631],{"class":315},"    fmt ",[271,633,370],{"class":311},[271,635,636],{"class":390}," FILE_FORMATS",[271,638,639],{"class":315},"[dst_path.suffix.lower()]\n",[271,641,643,645,647],{"class":273,"line":642},13,[271,644,367],{"class":315},[271,646,370],{"class":311},[271,648,649],{"class":315}," start_excel()\n",[271,651,653,656],{"class":273,"line":652},14,[271,654,655],{"class":311},"    try",[271,657,615],{"class":315},[271,659,661,664,666,669,671,674,678,680,682,685,688,690,693],{"class":273,"line":660},15,[271,662,663],{"class":315},"        wb ",[271,665,370],{"class":311},[271,667,668],{"class":315}," excel.Workbooks.Open(",[271,670,601],{"class":390},[271,672,673],{"class":315},"(src_path), ",[271,675,677],{"class":676},"sa561","UpdateLinks",[271,679,370],{"class":311},[271,681,64],{"class":390},[271,683,684],{"class":315},", ",[271,686,687],{"class":676},"ReadOnly",[271,689,370],{"class":311},[271,691,692],{"class":390},"True",[271,694,379],{"class":315},[271,696,698,701],{"class":273,"line":697},16,[271,699,700],{"class":311},"        try",[271,702,615],{"class":315},[271,704,706,709,711,714,717,719],{"class":273,"line":705},17,[271,707,708],{"class":315},"            wb.SaveAs(",[271,710,601],{"class":390},[271,712,713],{"class":315},"(dst_path), ",[271,715,716],{"class":676},"FileFormat",[271,718,370],{"class":311},[271,720,721],{"class":315},"fmt)\n",[271,723,725,728],{"class":273,"line":724},18,[271,726,727],{"class":311},"        finally",[271,729,615],{"class":315},[271,731,733,736,739,741,744],{"class":273,"line":732},19,[271,734,735],{"class":315},"            wb.Close(",[271,737,738],{"class":676},"SaveChanges",[271,740,370],{"class":311},[271,742,743],{"class":390},"False",[271,745,379],{"class":315},[271,747,749,752],{"class":273,"line":748},20,[271,750,751],{"class":311},"    finally",[271,753,615],{"class":315},[271,755,757],{"class":273,"line":756},21,[271,758,759],{"class":315},"        excel.Quit()\n",[271,761,763],{"class":273,"line":762},22,[271,764,329],{"emptyLinePlaceholder":328},[271,766,768,771,774,776,779],{"class":273,"line":767},23,[271,769,770],{"class":315},"convert(",[271,772,773],{"class":281},"\"reports\u002Fq3.xlsx\"",[271,775,684],{"class":315},[271,777,778],{"class":281},"\"reports\u002Fq3.xlsb\"",[271,780,379],{"class":315},[10,782,783,786,787,790,791,793],{},[19,784,785],{},"UpdateLinks=0"," stops Excel from trying to refresh links to other workbooks on open, and ",[19,788,789],{},"ReadOnly=True"," guarantees the source is never modified. The extension and the code must agree: saving format 51 to a name ending ",[19,792,25],{}," produces a file Excel later refuses to open without a warning.",[42,795,51,800,51,803,51,806,51,809,51,813,51,818,51,824,51,827,51,831,51,834,51,838,51,843,51,848,51,850,51,853,51,855,51,862,51,864,51,871,51,874,51,878,51,880,51,883,51,885,51,890,51,892,51,897,51,900,51,903,51,905,51,908,51,910,51,915,51,917,51,922,51,925,51,928,51,930,51,932,51,934,51,941,51,943,51,948,51,951,51,954,51,956,51,959,51,961,51,966,51,968,51,973,51,976,51,980,51,982,51,985,51,987,51,992,51,994],{"viewBox":796,"role":45,"ariaLabelledBy":797,"xmlns":49,"style":50},"4 0 752 276",[798,799],"com-codes-t","com-codes-d",[53,801,802],{"id":798},"FileFormat codes and what each target keeps",[57,804,805],{"id":799},"Code 51 xlsx keeps everything except macros. 52 xlsm keeps macros. 50 xlsb keeps everything in binary form. 56 legacy xls keeps macros but is limited to 65,536 rows. 62 CSV UTF-8 keeps only the values of the active sheet. 60 ODS keeps data and most formatting.",[61,807],{"x":63,"y":64,"width":65,"height":808,"fill":67},"276",[61,810],{"x":70,"y":104,"width":811,"height":812,"rx":64,"fill":67,"stroke":142,"style":143},"120.6","40.0",[61,814],{"x":815,"y":104,"width":816,"height":812,"rx":64,"fill":75,"stroke":76,"style":817},"140.6","199.8","stroke-width:1.2px",[90,819,823],{"x":820,"y":821,"style":822},"240.5","41.0","font-size:13px;font-weight:700;fill:var(--brand-strong,#4338ca);text-anchor:middle","Code",[61,825],{"x":826,"y":104,"width":816,"height":812,"rx":64,"fill":75,"stroke":76,"style":817},"340.4",[90,828,830],{"x":829,"y":821,"style":822},"440.3","Keeps formatting",[61,832],{"x":833,"y":104,"width":816,"height":812,"rx":64,"fill":75,"stroke":76,"style":817},"540.2",[90,835,837],{"x":836,"y":821,"style":822},"640.1","Keeps macros",[61,839],{"x":70,"y":840,"width":811,"height":841,"rx":64,"fill":842,"stroke":142,"style":143},"56.0","34.0","#e7ebef",[90,844,121],{"x":845,"y":846,"style":847},"32.0","78.0","font-size:12.5px;font-weight:700;fill:var(--text,#172033);text-anchor:start",[61,849],{"x":815,"y":840,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[90,851,497],{"x":820,"y":852,"style":99},"77.0",[61,854],{"x":826,"y":840,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[79,856,858],{"transform":857},"translate(431.3,64.0) scale(0.750)",[83,859],{"d":860,"fill":86,"stroke":108,"style":861},"M5 12.5l4.5 4.5L19 7","stroke-width:2.40px;stroke-linecap:round;stroke-linejoin:round",[61,863],{"x":833,"y":840,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[79,865,867],{"transform":866},"translate(632.1,65.0) scale(0.667)",[83,868],{"d":869,"fill":86,"stroke":224,"style":870},"M6 6l12 12 M18 6L6 18","stroke-width:2.70px;stroke-linecap:round;stroke-linejoin:round",[61,872],{"x":70,"y":873,"width":811,"height":841,"rx":64,"fill":842,"stroke":142,"style":143},"90.0",[90,875,877],{"x":845,"y":876,"style":847},"112.0",".xlsm",[61,879],{"x":815,"y":873,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[90,881,513],{"x":820,"y":882,"style":99},"111.0",[61,884],{"x":826,"y":873,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[79,886,888],{"transform":887},"translate(431.3,98.0) scale(0.750)",[83,889],{"d":860,"fill":86,"stroke":108,"style":861},[61,891],{"x":833,"y":873,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[79,893,895],{"transform":894},"translate(631.1,98.0) scale(0.750)",[83,896],{"d":860,"fill":86,"stroke":108,"style":861},[61,898],{"x":70,"y":899,"width":811,"height":841,"rx":64,"fill":842,"stroke":142,"style":143},"124.0",[90,901,21],{"x":845,"y":902,"style":847},"146.0",[61,904],{"x":815,"y":899,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[90,906,528],{"x":820,"y":907,"style":99},"145.0",[61,909],{"x":826,"y":899,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[79,911,913],{"transform":912},"translate(431.3,132.0) scale(0.750)",[83,914],{"d":860,"fill":86,"stroke":108,"style":861},[61,916],{"x":833,"y":899,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[79,918,920],{"transform":919},"translate(631.1,132.0) scale(0.750)",[83,921],{"d":860,"fill":86,"stroke":108,"style":861},[61,923],{"x":70,"y":924,"width":811,"height":841,"rx":64,"fill":842,"stroke":142,"style":143},"158.0",[90,926,186],{"x":845,"y":927,"style":847},"180.0",[61,929],{"x":815,"y":924,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[90,931,543],{"x":820,"y":159,"style":99},[61,933],{"x":826,"y":924,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[79,935,937],{"transform":936},"translate(431.8,166.5) scale(0.708)",[83,938],{"d":939,"fill":86,"stroke":175,"style":940},"M12 3.5l9.5 17h-19z M12 10v5 M12 17.8v.4","stroke-width:2.54px;stroke-linecap:round;stroke-linejoin:round",[61,942],{"x":833,"y":924,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[79,944,946],{"transform":945},"translate(631.1,166.0) scale(0.750)",[83,947],{"d":860,"fill":86,"stroke":108,"style":861},[61,949],{"x":70,"y":950,"width":811,"height":841,"rx":64,"fill":842,"stroke":142,"style":143},"192.0",[90,952,209],{"x":845,"y":953,"style":847},"214.0",[61,955],{"x":815,"y":950,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[90,957,559],{"x":820,"y":958,"style":99},"213.0",[61,960],{"x":826,"y":950,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[79,962,964],{"transform":963},"translate(432.3,201.0) scale(0.667)",[83,965],{"d":869,"fill":86,"stroke":224,"style":870},[61,967],{"x":833,"y":950,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[79,969,971],{"transform":970},"translate(632.1,201.0) scale(0.667)",[83,972],{"d":869,"fill":86,"stroke":224,"style":870},[61,974],{"x":70,"y":975,"width":811,"height":841,"rx":64,"fill":842,"stroke":142,"style":143},"226.0",[90,977,979],{"x":845,"y":978,"style":847},"248.0",".ods",[61,981],{"x":815,"y":975,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[90,983,574],{"x":820,"y":984,"style":99},"247.0",[61,986],{"x":826,"y":975,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[79,988,990],{"transform":989},"translate(431.8,234.5) scale(0.708)",[83,991],{"d":939,"fill":86,"stroke":175,"style":940},[61,993],{"x":833,"y":975,"width":816,"height":841,"rx":64,"fill":67,"stroke":142,"style":143},[79,995,997],{"transform":996},"translate(632.1,235.0) scale(0.667)",[83,998],{"d":869,"fill":86,"stroke":224,"style":870},[10,1000,1001,1002,1004,1005,1007,1008,1010,1011,1013],{},"Saving a macro workbook as ",[19,1003,121],{}," silently discards its VBA project — Excel would ask, but ",[19,1006,443],{}," answers \"yes, discard\" for you. Choose ",[19,1009,877],{}," or ",[19,1012,21],{}," when macros must survive.",[254,1015,1017],{"id":1016},"step-3-export-to-pdf","Step 3 — Export to PDF",[10,1019,1020,1021,1023,1024,1026,1027,1029,1030,1033],{},"PDF is not a ",[19,1022,29],{}," format; use ",[19,1025,33],{}," with type ",[19,1028,64],{}," (",[19,1031,1032],{},"xlTypePDF",") on the workbook or on a single sheet:",[262,1035,1037],{"className":302,"code":1036,"language":304,"meta":267,"style":267},"def to_pdf(src: str, dst: str, sheet: str | None = None) -> None:\n    excel = start_excel()\n    try:\n        wb = excel.Workbooks.Open(str(Path(src).resolve()), ReadOnly=True)\n        try:\n            target = wb.Worksheets(sheet) if sheet else wb\n            target.ExportAsFixedFormat(0, str(Path(dst).resolve()))\n        finally:\n            wb.Close(SaveChanges=False)\n    finally:\n        excel.Quit()\n\nto_pdf(\"reports\u002Fq3.xlsx\", \"reports\u002Fq3_summary.pdf\", sheet=\"Summary\")\n",[19,1038,1039,1075,1083,1089,1110,1116,1138,1152,1158,1170,1176,1180,1184],{"__ignoreMap":267},[271,1040,1041,1043,1046,1048,1050,1052,1054,1057,1059,1062,1065,1067,1069,1071,1073],{"class":273,"line":274},[271,1042,354],{"class":311},[271,1044,1045],{"class":357}," to_pdf",[271,1047,598],{"class":315},[271,1049,601],{"class":390},[271,1051,604],{"class":315},[271,1053,601],{"class":390},[271,1055,1056],{"class":315},", sheet: ",[271,1058,601],{"class":390},[271,1060,1061],{"class":311}," |",[271,1063,1064],{"class":390}," None",[271,1066,483],{"class":311},[271,1068,1064],{"class":390},[271,1070,609],{"class":315},[271,1072,612],{"class":390},[271,1074,615],{"class":315},[271,1076,1077,1079,1081],{"class":273,"line":325},[271,1078,367],{"class":315},[271,1080,370],{"class":311},[271,1082,649],{"class":315},[271,1084,1085,1087],{"class":273,"line":332},[271,1086,655],{"class":311},[271,1088,615],{"class":315},[271,1090,1091,1093,1095,1097,1099,1102,1104,1106,1108],{"class":273,"line":346},[271,1092,663],{"class":315},[271,1094,370],{"class":311},[271,1096,668],{"class":315},[271,1098,601],{"class":390},[271,1100,1101],{"class":315},"(Path(src).resolve()), ",[271,1103,687],{"class":676},[271,1105,370],{"class":311},[271,1107,692],{"class":390},[271,1109,379],{"class":315},[271,1111,1112,1114],{"class":273,"line":351},[271,1113,700],{"class":311},[271,1115,615],{"class":315},[271,1117,1118,1121,1123,1126,1129,1132,1135],{"class":273,"line":364},[271,1119,1120],{"class":315},"            target ",[271,1122,370],{"class":311},[271,1124,1125],{"class":315}," wb.Worksheets(sheet) ",[271,1127,1128],{"class":311},"if",[271,1130,1131],{"class":315}," sheet ",[271,1133,1134],{"class":311},"else",[271,1136,1137],{"class":315}," wb\n",[271,1139,1140,1143,1145,1147,1149],{"class":273,"line":382},[271,1141,1142],{"class":315},"            target.ExportAsFixedFormat(",[271,1144,64],{"class":390},[271,1146,684],{"class":315},[271,1148,601],{"class":390},[271,1150,1151],{"class":315},"(Path(dst).resolve()))\n",[271,1153,1154,1156],{"class":273,"line":394},[271,1155,727],{"class":311},[271,1157,615],{"class":315},[271,1159,1160,1162,1164,1166,1168],{"class":273,"line":409},[271,1161,735],{"class":315},[271,1163,738],{"class":676},[271,1165,370],{"class":311},[271,1167,743],{"class":390},[271,1169,379],{"class":315},[271,1171,1172,1174],{"class":273,"line":419},[271,1173,751],{"class":311},[271,1175,615],{"class":315},[271,1177,1178],{"class":273,"line":432},[271,1179,759],{"class":315},[271,1181,1182],{"class":273,"line":628},[271,1183,329],{"emptyLinePlaceholder":328},[271,1185,1186,1189,1191,1193,1196,1198,1201,1203,1206],{"class":273,"line":642},[271,1187,1188],{"class":315},"to_pdf(",[271,1190,773],{"class":281},[271,1192,684],{"class":315},[271,1194,1195],{"class":281},"\"reports\u002Fq3_summary.pdf\"",[271,1197,684],{"class":315},[271,1199,1200],{"class":676},"sheet",[271,1202,370],{"class":311},[271,1204,1205],{"class":281},"\"Summary\"",[271,1207,379],{"class":315},[10,1209,1210,1211,456],{},"The PDF follows each sheet's page setup — print area, orientation, scaling, headers — so set those in the workbook first; see ",[36,1212,1214],{"href":1213},"\u002Fautomating-reporting-workflows\u002Fexporting-excel-reports-to-pdf\u002Ffit-an-excel-sheet-to-one-page-in-pdf\u002F","Fit an Excel Sheet to One Page Wide When Exporting to PDF",[254,1216,1218],{"id":1217},"step-4-export-every-sheet-to-its-own-csv","Step 4 — Export every sheet to its own CSV",[10,1220,1221,1222,1224,1225,1228],{},"CSV holds one table, so ",[19,1223,29],{}," with a CSV code writes only the active sheet. To export them all, copy each sheet into a new single-sheet workbook and save that — calling ",[19,1226,1227],{},"Copy()"," with no arguments creates the new workbook:",[262,1230,1232],{"className":302,"code":1231,"language":304,"meta":267,"style":267},"def sheets_to_csv(src: str, out_dir: str) -> list[str]:\n    out = Path(out_dir).resolve()\n    out.mkdir(parents=True, exist_ok=True)\n    written = []\n    excel = start_excel()\n    try:\n        wb = excel.Workbooks.Open(str(Path(src).resolve()), ReadOnly=True)\n        try:\n            for ws in wb.Worksheets:\n                ws.Copy()                              # new workbook containing only this sheet\n                single = excel.ActiveWorkbook\n                target = out \u002F f\"{Path(src).stem}_{ws.Name}.csv\"\n                single.SaveAs(str(target), FileFormat=62)\n                single.Close(SaveChanges=False)\n                written.append(str(target))\n        finally:\n            wb.Close(SaveChanges=False)\n    finally:\n        excel.Quit()\n    return written\n",[19,1233,1234,1258,1268,1291,1301,1309,1315,1335,1341,1355,1363,1373,1415,1433,1446,1456,1462,1474,1480,1484],{"__ignoreMap":267},[271,1235,1236,1238,1241,1243,1245,1248,1250,1253,1255],{"class":273,"line":274},[271,1237,354],{"class":311},[271,1239,1240],{"class":357}," sheets_to_csv",[271,1242,598],{"class":315},[271,1244,601],{"class":390},[271,1246,1247],{"class":315},", out_dir: ",[271,1249,601],{"class":390},[271,1251,1252],{"class":315},") -> list[",[271,1254,601],{"class":390},[271,1256,1257],{"class":315},"]:\n",[271,1259,1260,1263,1265],{"class":273,"line":325},[271,1261,1262],{"class":315},"    out ",[271,1264,370],{"class":311},[271,1266,1267],{"class":315}," Path(out_dir).resolve()\n",[271,1269,1270,1273,1276,1278,1280,1282,1285,1287,1289],{"class":273,"line":332},[271,1271,1272],{"class":315},"    out.mkdir(",[271,1274,1275],{"class":676},"parents",[271,1277,370],{"class":311},[271,1279,692],{"class":390},[271,1281,684],{"class":315},[271,1283,1284],{"class":676},"exist_ok",[271,1286,370],{"class":311},[271,1288,692],{"class":390},[271,1290,379],{"class":315},[271,1292,1293,1296,1298],{"class":273,"line":346},[271,1294,1295],{"class":315},"    written ",[271,1297,370],{"class":311},[271,1299,1300],{"class":315}," []\n",[271,1302,1303,1305,1307],{"class":273,"line":351},[271,1304,367],{"class":315},[271,1306,370],{"class":311},[271,1308,649],{"class":315},[271,1310,1311,1313],{"class":273,"line":364},[271,1312,655],{"class":311},[271,1314,615],{"class":315},[271,1316,1317,1319,1321,1323,1325,1327,1329,1331,1333],{"class":273,"line":382},[271,1318,663],{"class":315},[271,1320,370],{"class":311},[271,1322,668],{"class":315},[271,1324,601],{"class":390},[271,1326,1101],{"class":315},[271,1328,687],{"class":676},[271,1330,370],{"class":311},[271,1332,692],{"class":390},[271,1334,379],{"class":315},[271,1336,1337,1339],{"class":273,"line":394},[271,1338,700],{"class":311},[271,1340,615],{"class":315},[271,1342,1343,1346,1349,1352],{"class":273,"line":409},[271,1344,1345],{"class":311},"            for",[271,1347,1348],{"class":315}," ws ",[271,1350,1351],{"class":311},"in",[271,1353,1354],{"class":315}," wb.Worksheets:\n",[271,1356,1357,1360],{"class":273,"line":419},[271,1358,1359],{"class":315},"                ws.Copy()                              ",[271,1361,1362],{"class":405},"# new workbook containing only this sheet\n",[271,1364,1365,1368,1370],{"class":273,"line":432},[271,1366,1367],{"class":315},"                single ",[271,1369,370],{"class":311},[271,1371,1372],{"class":315}," excel.ActiveWorkbook\n",[271,1374,1375,1378,1380,1383,1386,1389,1392,1396,1399,1402,1405,1407,1410,1412],{"class":273,"line":628},[271,1376,1377],{"class":315},"                target ",[271,1379,370],{"class":311},[271,1381,1382],{"class":315}," out ",[271,1384,1385],{"class":311},"\u002F",[271,1387,1388],{"class":311}," f",[271,1390,1391],{"class":281},"\"",[271,1393,1395],{"class":1394},"sSjpA","{",[271,1397,1398],{"class":315},"Path(src).stem",[271,1400,1401],{"class":1394},"}",[271,1403,1404],{"class":281},"_",[271,1406,1395],{"class":1394},[271,1408,1409],{"class":315},"ws.Name",[271,1411,1401],{"class":1394},[271,1413,1414],{"class":281},".csv\"\n",[271,1416,1417,1420,1422,1425,1427,1429,1431],{"class":273,"line":642},[271,1418,1419],{"class":315},"                single.SaveAs(",[271,1421,601],{"class":390},[271,1423,1424],{"class":315},"(target), ",[271,1426,716],{"class":676},[271,1428,370],{"class":311},[271,1430,559],{"class":390},[271,1432,379],{"class":315},[271,1434,1435,1438,1440,1442,1444],{"class":273,"line":652},[271,1436,1437],{"class":315},"                single.Close(",[271,1439,738],{"class":676},[271,1441,370],{"class":311},[271,1443,743],{"class":390},[271,1445,379],{"class":315},[271,1447,1448,1451,1453],{"class":273,"line":660},[271,1449,1450],{"class":315},"                written.append(",[271,1452,601],{"class":390},[271,1454,1455],{"class":315},"(target))\n",[271,1457,1458,1460],{"class":273,"line":697},[271,1459,727],{"class":311},[271,1461,615],{"class":315},[271,1463,1464,1466,1468,1470,1472],{"class":273,"line":705},[271,1465,735],{"class":315},[271,1467,738],{"class":676},[271,1469,370],{"class":311},[271,1471,743],{"class":390},[271,1473,379],{"class":315},[271,1475,1476,1478],{"class":273,"line":724},[271,1477,751],{"class":311},[271,1479,615],{"class":315},[271,1481,1482],{"class":273,"line":732},[271,1483,759],{"class":315},[271,1485,1486,1488],{"class":273,"line":748},[271,1487,435],{"class":311},[271,1489,1490],{"class":315}," written\n",[10,1492,1493,1494,1497],{},"Code 62 writes UTF-8, which preserves accented names and symbols; the older code 6 writes in the system's ANSI code page and garbles anything outside it. Excel writes values ",[14,1495,1496],{},"as displayed",", so a number formatted with two decimals is exported with two decimals — useful for reports, surprising for data interchange. When you need raw values, read the workbook with pandas and write the CSV from Python instead.",[254,1499,1501],{"id":1500},"step-5-convert-a-whole-folder","Step 5 — Convert a whole folder",[10,1503,1504],{},"For batch jobs, start Excel once and reuse it for every file — starting Excel takes seconds, a conversion a fraction of that. Record failures and carry on, so one broken file does not stop the batch:",[262,1506,1508],{"className":302,"code":1507,"language":304,"meta":267,"style":267},"def convert_folder(src_dir: str, pattern: str, suffix: str) -> dict:\n    results = {\"ok\": [], \"failed\": []}\n    fmt = FILE_FORMATS[suffix]\n    excel = start_excel()\n    try:\n        for src in sorted(Path(src_dir).resolve().glob(pattern)):\n            dst = src.with_suffix(suffix)\n            try:\n                wb = excel.Workbooks.Open(str(src), UpdateLinks=0, ReadOnly=True)\n                try:\n                    wb.SaveAs(str(dst), FileFormat=fmt)\n                finally:\n                    wb.Close(SaveChanges=False)\n                results[\"ok\"].append(src.name)\n            except Exception as exc:          # pywintypes.com_error in practice\n                results[\"failed\"].append((src.name, str(exc)))\n    finally:\n        excel.Quit()\n    return results\n\nprint(convert_folder(\"legacy\", \"*.xls\", \".xlsx\"))\n",[19,1509,1510,1539,1561,1572,1580,1586,1602,1612,1619,1649,1656,1672,1679,1692,1702,1719,1733,1739,1743,1750,1754],{"__ignoreMap":267},[271,1511,1512,1514,1517,1520,1522,1525,1527,1530,1532,1534,1537],{"class":273,"line":274},[271,1513,354],{"class":311},[271,1515,1516],{"class":357}," convert_folder",[271,1518,1519],{"class":315},"(src_dir: ",[271,1521,601],{"class":390},[271,1523,1524],{"class":315},", pattern: ",[271,1526,601],{"class":390},[271,1528,1529],{"class":315},", suffix: ",[271,1531,601],{"class":390},[271,1533,609],{"class":315},[271,1535,1536],{"class":390},"dict",[271,1538,615],{"class":315},[271,1540,1541,1544,1546,1549,1552,1555,1558],{"class":273,"line":325},[271,1542,1543],{"class":315},"    results ",[271,1545,370],{"class":311},[271,1547,1548],{"class":315}," {",[271,1550,1551],{"class":281},"\"ok\"",[271,1553,1554],{"class":315},": [], ",[271,1556,1557],{"class":281},"\"failed\"",[271,1559,1560],{"class":315},": []}\n",[271,1562,1563,1565,1567,1569],{"class":273,"line":332},[271,1564,631],{"class":315},[271,1566,370],{"class":311},[271,1568,636],{"class":390},[271,1570,1571],{"class":315},"[suffix]\n",[271,1573,1574,1576,1578],{"class":273,"line":346},[271,1575,367],{"class":315},[271,1577,370],{"class":311},[271,1579,649],{"class":315},[271,1581,1582,1584],{"class":273,"line":351},[271,1583,655],{"class":311},[271,1585,615],{"class":315},[271,1587,1588,1591,1594,1596,1599],{"class":273,"line":364},[271,1589,1590],{"class":311},"        for",[271,1592,1593],{"class":315}," src ",[271,1595,1351],{"class":311},[271,1597,1598],{"class":390}," sorted",[271,1600,1601],{"class":315},"(Path(src_dir).resolve().glob(pattern)):\n",[271,1603,1604,1607,1609],{"class":273,"line":382},[271,1605,1606],{"class":315},"            dst ",[271,1608,370],{"class":311},[271,1610,1611],{"class":315}," src.with_suffix(suffix)\n",[271,1613,1614,1617],{"class":273,"line":394},[271,1615,1616],{"class":311},"            try",[271,1618,615],{"class":315},[271,1620,1621,1624,1626,1628,1630,1633,1635,1637,1639,1641,1643,1645,1647],{"class":273,"line":409},[271,1622,1623],{"class":315},"                wb ",[271,1625,370],{"class":311},[271,1627,668],{"class":315},[271,1629,601],{"class":390},[271,1631,1632],{"class":315},"(src), ",[271,1634,677],{"class":676},[271,1636,370],{"class":311},[271,1638,64],{"class":390},[271,1640,684],{"class":315},[271,1642,687],{"class":676},[271,1644,370],{"class":311},[271,1646,692],{"class":390},[271,1648,379],{"class":315},[271,1650,1651,1654],{"class":273,"line":419},[271,1652,1653],{"class":311},"                try",[271,1655,615],{"class":315},[271,1657,1658,1661,1663,1666,1668,1670],{"class":273,"line":432},[271,1659,1660],{"class":315},"                    wb.SaveAs(",[271,1662,601],{"class":390},[271,1664,1665],{"class":315},"(dst), ",[271,1667,716],{"class":676},[271,1669,370],{"class":311},[271,1671,721],{"class":315},[271,1673,1674,1677],{"class":273,"line":628},[271,1675,1676],{"class":311},"                finally",[271,1678,615],{"class":315},[271,1680,1681,1684,1686,1688,1690],{"class":273,"line":642},[271,1682,1683],{"class":315},"                    wb.Close(",[271,1685,738],{"class":676},[271,1687,370],{"class":311},[271,1689,743],{"class":390},[271,1691,379],{"class":315},[271,1693,1694,1697,1699],{"class":273,"line":652},[271,1695,1696],{"class":315},"                results[",[271,1698,1551],{"class":281},[271,1700,1701],{"class":315},"].append(src.name)\n",[271,1703,1704,1707,1710,1713,1716],{"class":273,"line":660},[271,1705,1706],{"class":311},"            except",[271,1708,1709],{"class":390}," Exception",[271,1711,1712],{"class":311}," as",[271,1714,1715],{"class":315}," exc:          ",[271,1717,1718],{"class":405},"# pywintypes.com_error in practice\n",[271,1720,1721,1723,1725,1728,1730],{"class":273,"line":697},[271,1722,1696],{"class":315},[271,1724,1557],{"class":281},[271,1726,1727],{"class":315},"].append((src.name, ",[271,1729,601],{"class":390},[271,1731,1732],{"class":315},"(exc)))\n",[271,1734,1735,1737],{"class":273,"line":705},[271,1736,751],{"class":311},[271,1738,615],{"class":315},[271,1740,1741],{"class":273,"line":724},[271,1742,759],{"class":315},[271,1744,1745,1747],{"class":273,"line":732},[271,1746,435],{"class":311},[271,1748,1749],{"class":315}," results\n",[271,1751,1752],{"class":273,"line":748},[271,1753,329],{"emptyLinePlaceholder":328},[271,1755,1756,1759,1762,1765,1767,1770,1772,1775],{"class":273,"line":756},[271,1757,1758],{"class":390},"print",[271,1760,1761],{"class":315},"(convert_folder(",[271,1763,1764],{"class":281},"\"legacy\"",[271,1766,684],{"class":315},[271,1768,1769],{"class":281},"\"*.xls\"",[271,1771,684],{"class":315},[271,1773,1774],{"class":281},"\".xlsx\"",[271,1776,1777],{"class":315},"))\n",[10,1779,1780,1781,1783,1784,1786,1787,1790,1791,456],{},"A typical use is retiring a folder of legacy ",[19,1782,25],{}," files: convert once to ",[19,1785,121],{},", and every later step can use openpyxl and pandas without the ",[19,1788,1789],{},"xlrd"," special case described in ",[36,1792,1794],{"href":1793},"\u002Fgetting-started-with-python-excel-automation\u002Fhandling-excel-file-formats-and-conversions\u002Fconvert-xls-to-xlsx-with-python\u002F","Convert .xls to .xlsx with Python",[42,1796,51,1801,51,1804,51,1807,51,1810,51,1814,51,1819,51,1824,51,1828,51,1835,51,1840,51,1845,51,1848,51,1851,51,1858,51,1863,51,1866,51,1870,51,1873,51,1877,51,1880,51,1883,51,1889,51,1893,51,1896,51,1900,51,1903,51,1907,51,1910,51,1913,51,1918,51,1923,51,1926,51,1930],{"viewBox":1797,"role":45,"ariaLabelledBy":1798,"xmlns":49,"style":50},"4 0 752 133",[1799,1800],"com-batch-t","com-batch-d",[53,1802,1803],{"id":1799},"Batch conversion with one Excel instance",[57,1805,1806],{"id":1800},"Excel is started once. For each file in the folder, the workbook is opened read-only, saved in the new format, and closed; failures are recorded and the loop continues. Excel quits in a finally block when the folder is done.",[61,1808],{"x":63,"y":64,"width":65,"height":1809,"fill":67},"133",[61,1811],{"x":70,"y":104,"width":1812,"height":1813,"rx":74,"fill":75,"stroke":76,"style":77},"153.0","101.0",[79,1815,1817],{"transform":1816},"translate(84.5,33.0) scale(1.000)",[83,1818],{"d":85,"fill":86,"stroke":87,"style":88},[90,1820,1823],{"x":1821,"y":1822,"style":94},"96.5","79.5","Start Excel once",[90,1825,1827],{"x":1821,"y":1826,"style":99},"99.0","DispatchEx, alerts off",[1829,1830],"circle",{"cx":1831,"cy":845,"r":1832,"fill":1833,"stroke":86,"style":1834},"36.0","11.0","#4338ca","stroke-width:0px",[90,1836,1839],{"x":1831,"y":1837,"style":1838},"36.5","font-size:12px;font-weight:700;fill:#ffffff;text-anchor:middle","1",[273,1841],{"x1":1842,"y1":1843,"x2":1844,"y2":1843,"stroke":76,"style":77},"178.0","66.5","200.0",[131,1846],{"points":1847,"fill":134},"204.0,66.5 195.0,71.5 195.0,61.5",[61,1849],{"x":1850,"y":104,"width":1812,"height":1813,"rx":74,"fill":842,"stroke":142,"style":77},"209.0",[79,1852,1854],{"transform":1853},"translate(273.5,33.0) scale(1.000)",[83,1855],{"d":1856,"fill":86,"stroke":1857,"style":88},"M3 6h6l2 2h10v11H3z","var(--text,#172033)",[90,1859,1862],{"x":1860,"y":1822,"style":1861},"285.5","font-size:13.5px;font-weight:700;fill:var(--text,#172033);text-anchor:middle","For each file",[90,1864,1865],{"x":1860,"y":1826,"style":99},"open read-only",[1829,1867],{"cx":1868,"cy":845,"r":1832,"fill":1869,"stroke":86,"style":1834},"225.0","#5b6780",[90,1871,1872],{"x":1868,"y":1837,"style":1838},"2",[273,1874],{"x1":1875,"y1":1843,"x2":1876,"y2":1843,"stroke":76,"style":77},"367.0","389.0",[131,1878],{"points":1879,"fill":134},"393.0,66.5 384.0,71.5 384.0,61.5",[61,1881],{"x":1882,"y":104,"width":1812,"height":1813,"rx":74,"fill":107,"stroke":108,"style":77},"398.0",[79,1884,1886],{"transform":1885},"translate(462.5,33.0) scale(1.000)",[83,1887],{"d":1888,"fill":86,"stroke":115,"style":88},"M20 11a8 8 0 1 0-2.3 5.7 M20 4v7h-7",[90,1890,29],{"x":1891,"y":1822,"style":1892},"474.5","font-size:13.5px;font-weight:700;fill:var(--teal-ink,#0b6157);text-anchor:middle",[90,1894,1895],{"x":1891,"y":1826,"style":99},"record ok or failed",[1829,1897],{"cx":1898,"cy":845,"r":1832,"fill":1899,"stroke":86,"style":1834},"414.0","#0b6157",[90,1901,1902],{"x":1898,"y":1837,"style":1838},"3",[273,1904],{"x1":1905,"y1":1843,"x2":1906,"y2":1843,"stroke":76,"style":77},"556.0","578.0",[131,1908],{"points":1909,"fill":134},"582.0,66.5 573.0,71.5 573.0,61.5",[61,1911],{"x":1912,"y":104,"width":1812,"height":1813,"rx":74,"fill":174,"stroke":175,"style":77},"587.0",[79,1914,1916],{"transform":1915},"translate(651.5,33.0) scale(1.000)",[83,1917],{"d":860,"fill":86,"stroke":182,"style":88},[90,1919,1922],{"x":1920,"y":1822,"style":1921},"663.5","font-size:13.5px;font-weight:700;fill:var(--gold-ink,#7a4e06);text-anchor:middle","Quit in finally",[90,1924,1925],{"x":1920,"y":1826,"style":99},"no orphan EXCEL.EXE",[1829,1927],{"cx":1928,"cy":845,"r":1832,"fill":1929,"stroke":86,"style":1834},"603.0","#8a5808",[90,1931,63],{"x":1928,"y":1837,"style":1838},[254,1933,1935],{"id":1934},"step-6-check-what-the-conversion-produced","Step 6 — Check what the conversion produced",[10,1937,1938,1939,1941],{},"A conversion that raised no error can still produce a surprise: a ",[19,1940,25],{}," target truncated at 65,536 rows, a sheet that did not survive, a CSV written in the wrong encoding. Read each result back with Python — no Excel needed — and compare it with the source:",[262,1943,1945],{"className":302,"code":1944,"language":304,"meta":267,"style":267},"import pandas as pd\n\ndef compare(src: str, dst: str) -> list[str]:\n    engine = \"calamine\" if dst.endswith((\".xlsb\", \".xls\", \".ods\")) else None\n    before = pd.read_excel(src, sheet_name=None)\n    after = pd.read_excel(dst, sheet_name=None, engine=engine)\n    problems = []\n    if list(before) != list(after):\n        problems.append(f\"sheets differ: {list(before)} -> {list(after)}\")\n    for name, frame in before.items():\n        if name in after and len(after[name]) != len(frame):\n            problems.append(f\"{name}: {len(frame)} rows -> {len(after[name])} rows\")\n    return problems\n\nprint(compare(\"reports\u002Fq3.xlsx\", \"reports\u002Fq3.xlsb\"))   # [] when nothing was lost\n",[19,1946,1947,1959,1963,1984,2021,2040,2066,2075,2094,2131,2144,2173,2218,2225,2229],{"__ignoreMap":267},[271,1948,1949,1951,1954,1956],{"class":273,"line":274},[271,1950,319],{"class":311},[271,1952,1953],{"class":315}," pandas ",[271,1955,340],{"class":311},[271,1957,1958],{"class":315}," pd\n",[271,1960,1961],{"class":273,"line":325},[271,1962,329],{"emptyLinePlaceholder":328},[271,1964,1965,1967,1970,1972,1974,1976,1978,1980,1982],{"class":273,"line":332},[271,1966,354],{"class":311},[271,1968,1969],{"class":357}," compare",[271,1971,598],{"class":315},[271,1973,601],{"class":390},[271,1975,604],{"class":315},[271,1977,601],{"class":390},[271,1979,1252],{"class":315},[271,1981,601],{"class":390},[271,1983,1257],{"class":315},[271,1985,1986,1989,1991,1994,1997,2000,2003,2005,2008,2010,2013,2016,2018],{"class":273,"line":346},[271,1987,1988],{"class":315},"    engine ",[271,1990,370],{"class":311},[271,1992,1993],{"class":281}," \"calamine\"",[271,1995,1996],{"class":311}," if",[271,1998,1999],{"class":315}," dst.endswith((",[271,2001,2002],{"class":281},"\".xlsb\"",[271,2004,684],{"class":315},[271,2006,2007],{"class":281},"\".xls\"",[271,2009,684],{"class":315},[271,2011,2012],{"class":281},"\".ods\"",[271,2014,2015],{"class":315},")) ",[271,2017,1134],{"class":311},[271,2019,2020],{"class":390}," None\n",[271,2022,2023,2026,2028,2031,2034,2036,2038],{"class":273,"line":351},[271,2024,2025],{"class":315},"    before ",[271,2027,370],{"class":311},[271,2029,2030],{"class":315}," pd.read_excel(src, ",[271,2032,2033],{"class":676},"sheet_name",[271,2035,370],{"class":311},[271,2037,612],{"class":390},[271,2039,379],{"class":315},[271,2041,2042,2045,2047,2050,2052,2054,2056,2058,2061,2063],{"class":273,"line":364},[271,2043,2044],{"class":315},"    after ",[271,2046,370],{"class":311},[271,2048,2049],{"class":315}," pd.read_excel(dst, ",[271,2051,2033],{"class":676},[271,2053,370],{"class":311},[271,2055,612],{"class":390},[271,2057,684],{"class":315},[271,2059,2060],{"class":676},"engine",[271,2062,370],{"class":311},[271,2064,2065],{"class":315},"engine)\n",[271,2067,2068,2071,2073],{"class":273,"line":382},[271,2069,2070],{"class":315},"    problems ",[271,2072,370],{"class":311},[271,2074,1300],{"class":315},[271,2076,2077,2080,2083,2086,2089,2091],{"class":273,"line":394},[271,2078,2079],{"class":311},"    if",[271,2081,2082],{"class":390}," list",[271,2084,2085],{"class":315},"(before) ",[271,2087,2088],{"class":311},"!=",[271,2090,2082],{"class":390},[271,2092,2093],{"class":315},"(after):\n",[271,2095,2096,2099,2102,2105,2107,2110,2113,2115,2118,2120,2122,2125,2127,2129],{"class":273,"line":409},[271,2097,2098],{"class":315},"        problems.append(",[271,2100,2101],{"class":311},"f",[271,2103,2104],{"class":281},"\"sheets differ: ",[271,2106,1395],{"class":1394},[271,2108,2109],{"class":390},"list",[271,2111,2112],{"class":315},"(before)",[271,2114,1401],{"class":1394},[271,2116,2117],{"class":281}," -> ",[271,2119,1395],{"class":1394},[271,2121,2109],{"class":390},[271,2123,2124],{"class":315},"(after)",[271,2126,1401],{"class":1394},[271,2128,1391],{"class":281},[271,2130,379],{"class":315},[271,2132,2133,2136,2139,2141],{"class":273,"line":419},[271,2134,2135],{"class":311},"    for",[271,2137,2138],{"class":315}," name, frame ",[271,2140,1351],{"class":311},[271,2142,2143],{"class":315}," before.items():\n",[271,2145,2146,2149,2152,2154,2157,2160,2163,2166,2168,2170],{"class":273,"line":432},[271,2147,2148],{"class":311},"        if",[271,2150,2151],{"class":315}," name ",[271,2153,1351],{"class":311},[271,2155,2156],{"class":315}," after ",[271,2158,2159],{"class":311},"and",[271,2161,2162],{"class":390}," len",[271,2164,2165],{"class":315},"(after[name]) ",[271,2167,2088],{"class":311},[271,2169,2162],{"class":390},[271,2171,2172],{"class":315},"(frame):\n",[271,2174,2175,2178,2180,2182,2184,2187,2189,2191,2193,2196,2199,2201,2204,2206,2208,2211,2213,2216],{"class":273,"line":628},[271,2176,2177],{"class":315},"            problems.append(",[271,2179,2101],{"class":311},[271,2181,1391],{"class":281},[271,2183,1395],{"class":1394},[271,2185,2186],{"class":315},"name",[271,2188,1401],{"class":1394},[271,2190,494],{"class":281},[271,2192,1395],{"class":1394},[271,2194,2195],{"class":390},"len",[271,2197,2198],{"class":315},"(frame)",[271,2200,1401],{"class":1394},[271,2202,2203],{"class":281}," rows -> ",[271,2205,1395],{"class":1394},[271,2207,2195],{"class":390},[271,2209,2210],{"class":315},"(after[name])",[271,2212,1401],{"class":1394},[271,2214,2215],{"class":281}," rows\"",[271,2217,379],{"class":315},[271,2219,2220,2222],{"class":273,"line":642},[271,2221,435],{"class":311},[271,2223,2224],{"class":315}," problems\n",[271,2226,2227],{"class":273,"line":652},[271,2228,329],{"emptyLinePlaceholder":328},[271,2230,2231,2233,2236,2238,2240,2242,2245],{"class":273,"line":660},[271,2232,1758],{"class":390},[271,2234,2235],{"class":315},"(compare(",[271,2237,773],{"class":281},[271,2239,684],{"class":315},[271,2241,778],{"class":281},[271,2243,2244],{"class":315},"))   ",[271,2246,2247],{"class":405},"# [] when nothing was lost\n",[10,2249,2250,2251,684,2253,2255,2256,2258,2259,2261],{},"The calamine engine reads ",[19,2252,21],{},[19,2254,25],{}," and ",[19,2257,979],{}," alike, so one function checks every target format. For the legacy ",[19,2260,25],{}," format in particular, the row check is worth keeping in the batch: Excel 97-2003 files hold at most 65,536 rows and 256 columns, and anything beyond that is cut off during conversion — with alerts disabled, silently.",[254,2263,2265],{"id":2264},"common-pitfalls","Common pitfalls",[2267,2268,2269,2277,2283,2292],"ul",{},[2270,2271,2272,2276],"li",{},[2273,2274,2275],"strong",{},"Relative paths."," COM resolves paths against Excel's own current directory. Always pass absolute paths.",[2270,2278,2279,2282],{},[2273,2280,2281],{},"Mismatched extension and code."," The format code, not the extension, decides the file's content. Keep them in one mapping so they cannot drift.",[2270,2284,2285,2288,2289,2291],{},[2273,2286,2287],{},"Silent macro loss."," With alerts off, saving a macro workbook as ",[19,2290,121],{}," discards the macros without asking.",[2270,2293,2294,2297,2298,2300],{},[2273,2295,2296],{},"Files open elsewhere."," A source open in another Excel window can be read, but a target that is open elsewhere cannot be overwritten; ",[19,2299,29],{}," raises a COM error. Check the failed list.",[254,2302,2304],{"id":2303},"performance-and-scale-notes","Performance and scale notes",[10,2306,2307,2308,2310,2311,456],{},"Excel converts a typical workbook in well under a second once it is running; startup dominates, so reuse one instance across a batch and restart it every few hundred files to release memory. Conversions run one at a time per Excel process — COM automation of Excel is single-threaded — so for very large batches run several worker processes, each with its own ",[19,2309,298],{}," instance. Running such jobs unattended from Task Scheduler has its own requirements, covered in ",[36,2312,2314],{"href":2313},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Frun-excel-com-automation-from-task-scheduler\u002F","Run Excel COM Automation from Task Scheduler Without a Logged-In User",[254,2316,2318],{"id":2317},"conclusion","Conclusion",[10,2320,2321,2322,1010,2324,2326,2327,2329,2330,2332,2333,2335,2336,2339,2340,2343],{},"When a conversion must be faithful, or must produce ",[19,2323,21],{},[19,2325,25],{},", let Excel do it through pywin32: a private ",[19,2328,298],{}," instance with alerts, screen updating and events off; ",[19,2331,29],{}," with the ",[19,2334,469],{}," code that matches the extension; ",[19,2337,2338],{},"ExportAsFixedFormat(0, …)"," for PDF; a copy-to-new-workbook step for per-sheet CSV; and one reused instance, with failures recorded, for folders. Always pass absolute paths and quit Excel in a ",[19,2341,2342],{},"finally"," block.",[254,2345,2347],{"id":2346},"frequently-asked-questions","Frequently asked questions",[10,2349,2350,2353],{},[2273,2351,2352],{},"What FileFormat code saves an .xlsx file?","\n51 (xlOpenXMLWorkbook). Other common codes are 52 for .xlsm, 50 for .xlsb, 56 for the legacy .xls format, 62 for CSV UTF-8, 6 for classic CSV and 60 for OpenDocument .ods.",[10,2355,2356,2359],{},[2273,2357,2358],{},"Why does SaveAs to CSV only save one sheet?","\nCSV holds a single table, so Excel saves only the active sheet. To export every sheet, copy each one into a new workbook and save that as CSV, as shown in this guide.",[10,2361,2362,2365],{},[2273,2363,2364],{},"How do I stop Excel asking whether to overwrite a file?","\nSet excel.DisplayAlerts = False before SaveAs. Excel then overwrites silently, so check for existing files yourself if overwriting would be a mistake.",[10,2367,2368,2371],{},[2273,2369,2370],{},"Why use Excel for conversion when pandas can do it?","\nExcel is the only tool that writes .xlsb and .xls, and it converts with full fidelity — formatting, charts, macros and formulas survive. pandas conversions keep data only.",[254,2373,2375],{"id":2374},"related","Related",[2267,2377,2378,2384,2391,2398],{},[2270,2379,2380,2381,2383],{},"Up one level: ",[36,2382,39],{"href":38}," — the COM basics.",[2270,2385,2386,2390],{},[36,2387,2389],{"href":2388},"\u002Fgetting-started-with-python-excel-automation\u002Fhandling-excel-file-formats-and-conversions\u002F","Handling Excel File Formats and Conversions"," — conversions without Excel.",[2270,2392,2393,2397],{},[36,2394,2396],{"href":2395},"\u002Fautomating-reporting-workflows\u002Fexporting-excel-reports-to-pdf\u002Fconvert-excel-file-to-pdf-with-python\u002F","Convert an Excel File to PDF with Python"," — every route to PDF.",[2270,2399,2400,2404],{},[36,2401,2403],{"href":2402},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fhandle-com-errors-and-excel-dialog-prompts-in-python\u002F","Handle COM Errors and Excel Dialog Prompts in Python"," — when SaveAs fails.",[2406,2407,2408],"style",{},"html pre.shiki code .sMTad, html code.shiki .sMTad{--shiki-default:#6F42C1;--shiki-dark:#FFB757}html pre.shiki code .srMev, html code.shiki .srMev{--shiki-default:#032F62;--shiki-dark:#ADDCFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s-kum, html code.shiki .s-kum{--shiki-default:#D73A49;--shiki-dark:#FF9492}html pre.shiki code .skGVy, html code.shiki .skGVy{--shiki-default:#24292E;--shiki-dark:#F0F3F6}html pre.shiki code .s_Opv, html code.shiki .s_Opv{--shiki-default:#6F42C1;--shiki-dark:#DBB7FF}html pre.shiki code .sP0c6, html code.shiki .sP0c6{--shiki-default:#005CC5;--shiki-dark:#91CBFF}html pre.shiki code .s-wDw, html code.shiki .s-wDw{--shiki-default:#6A737D;--shiki-dark:#BDC4CC}html pre.shiki code .sa561, html code.shiki .sa561{--shiki-default:#E36209;--shiki-dark:#FFB757}html pre.shiki code .sSjpA, html code.shiki .sSjpA{--shiki-default:#005CC5;--shiki-dark:#FF9492}",{"title":267,"searchDepth":325,"depth":325,"links":2410},[2411,2412,2413,2414,2415,2416,2417,2418,2419,2420,2421,2422],{"id":256,"depth":325,"text":257},{"id":291,"depth":325,"text":292},{"id":459,"depth":325,"text":460},{"id":1016,"depth":325,"text":1017},{"id":1217,"depth":325,"text":1218},{"id":1500,"depth":325,"text":1501},{"id":1934,"depth":325,"text":1935},{"id":2264,"depth":325,"text":2265},{"id":2303,"depth":325,"text":2304},{"id":2317,"depth":325,"text":2318},{"id":2346,"depth":325,"text":2347},{"id":2374,"depth":325,"text":2375},"2026-09-23","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.","md",[2427,2429,2431,2433],{"q":2352,"a":2428},"51 (xlOpenXMLWorkbook). Other common codes are 52 for .xlsm, 50 for .xlsb, 56 for the legacy .xls format, 62 for CSV UTF-8, 6 for classic CSV and 60 for OpenDocument .ods.",{"q":2358,"a":2430},"CSV holds a single table, so Excel saves only the active sheet. To export every sheet, copy each one into a new workbook and save that as CSV, as shown in this guide.",{"q":2364,"a":2432},"Set excel.DisplayAlerts = False before SaveAs. Excel then overwrites silently, so check for existing files yourself if overwriting would be a mistake.",{"q":2370,"a":2434},"Excel is the only tool that writes .xlsb and .xls, and it converts with full fidelity — formatting, charts, macros and formulas survive. pandas conversions keep data only.","save a workbook in another format with win32com",null,{"breadcrumb":2438},[2439,2441,2444],{"name":2440,"item":1385},"Home",{"name":2442,"item":2443},"Getting Started with Python Excel Automation","\u002Fgetting-started-with-python-excel-automation\u002F",{"name":39,"item":38},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fsave-a-workbook-in-another-format-with-win32com",{"title":2447,"description":2448},"Convert Excel Files with win32com SaveAs (xls, xlsb, csv, pdf)","Convert Excel files with Python and pywin32 — Workbook.SaveAs FileFormat codes for xlsx, xlsm, xlsb, xls, CSV UTF-8 and ODS, PDF export, avoiding prompts, exporting every sheet to CSV, and batch folders.","save-a-workbook-in-another-format-with-win32com","getting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fsave-a-workbook-in-another-format-with-win32com\u002Findex",[2452,2453],"com-automation","file-formats","how-to","Q_LWvoMinx0YYREVlEHcjCkMOl7JELZI0A80nEJBan4",[2457,2460],{"title":2314,"path":2458,"stem":2459,"children":-1},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Frun-excel-com-automation-from-task-scheduler","getting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Frun-excel-com-automation-from-task-scheduler\u002Findex",{"title":2461,"path":2462,"stem":2463,"children":-1},"xlwings vs pywin32 for Excel Automation","\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fxlwings-vs-pywin32-for-excel-automation","getting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fxlwings-vs-pywin32-for-excel-automation\u002Findex",[2465,2467],{"path":2466,"title":39},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32",{"path":2468,"title":2442},"\u002Fgetting-started-with-python-excel-automation",[],[2471,2474,2477,2480,2482,2485],{"path":2472,"title":2473,"kind":2454},"\u002Fautomating-reporting-workflows\u002Ftesting-and-packaging-excel-automation-scripts\u002Ftest-win32com-and-xlwings-code-without-excel","Test win32com and xlwings Code Without Excel",{"path":2475,"title":2476,"kind":2454},"\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",{"path":2478,"title":2479,"kind":2454},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fautomate-excel-on-macos-with-python","Automate Excel on macOS with Python",{"path":2481,"title":455,"kind":2454},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fclose-excel-cleanly-and-avoid-orphan-com-processes",{"path":2483,"title":2403,"kind":2484},"\u002Fgetting-started-with-python-excel-automation\u002Fautomating-excel-with-com-and-pywin32\u002Fhandle-com-errors-and-excel-dialog-prompts-in-python","fix",{"path":2486,"title":2487,"kind":2454},"\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",1790972056883]