[{"data":1,"prerenderedAt":1139},["ShallowReactive",2],{"doc:\u002Fformatting-and-charting-excel-reports-with-python\u002Fstyling-excel-cells-with-openpyxl\u002Ffreeze-header-row-in-excel-with-openpyxl":3,"surround:\u002Fformatting-and-charting-excel-reports-with-python\u002Fstyling-excel-cells-with-openpyxl\u002Ffreeze-header-row-in-excel-with-openpyxl":1132},{"id":4,"title":5,"body":6,"description":1123,"extension":1124,"meta":1125,"navigation":85,"path":1126,"seo":1127,"stem":1130,"__hash__":1131},"docs\u002Fformatting-and-charting-excel-reports-with-python\u002Fstyling-excel-cells-with-openpyxl\u002Ffreeze-header-row-in-excel-with-openpyxl\u002Findex.md","Freeze the Header Row in Excel with openpyxl",{"type":7,"value":8,"toc":1109},"minimark",[9,24,29,54,57,291,295,314,403,407,414,505,508,512,515,597,601,607,689,693,700,782,786,796,889,893,990,994,997,1001,1012,1024,1033,1044,1053,1057,1075,1079,1105],[10,11,12,13,17,18,23],"p",{},"When a report is taller than the screen, the column headers scroll out of view and every number loses its label. Freezing the header row pins it in place so it stays visible as you scroll. With openpyxl it is a single attribute — ",[14,15,16],"code",{},"ws.freeze_panes"," — but the anchor-cell rule trips people up. This guide, part of ",[19,20,22],"a",{"href":21},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fstyling-excel-cells-with-openpyxl\u002F","Styling Excel Cells with openpyxl",", covers freezing rows, columns, both, and removing the freeze. Every block runs in order against a sample workbook built first.",[25,26,28],"h2",{"id":27},"install-and-create-a-sample-workbook","Install and create a sample workbook",[30,31,36],"pre",{"className":32,"code":33,"language":34,"meta":35,"style":35},"language-bash shiki shiki-themes github-light github-dark","pip install openpyxl\n","bash","",[14,37,38],{"__ignoreMap":35},[39,40,43,47,51],"span",{"class":41,"line":42},"line",1,[39,44,46],{"class":45},"sScJk","pip",[39,48,50],{"class":49},"sZZnC"," install",[39,52,53],{"class":49}," openpyxl\n",[10,55,56],{},"Build a sheet with enough rows that scrolling matters:",[30,58,62],{"className":59,"code":60,"language":61,"meta":35,"style":35},"language-python shiki shiki-themes github-light github-dark","from openpyxl import Workbook\n\nwb = Workbook()\nws = wb.active\nws.title = \"Ledger\"\n\nws.append([\"Date\", \"Account\", \"Description\", \"Amount\"])\nfor i in range(1, 41):\n    ws.append([f\"2024-08-{i:02d}\", f\"ACC-{i:03d}\", f\"Entry {i}\", i * 100])\n\nwb.save(\"frozen_report.xlsx\")\nprint(\"Sample workbook created with\", ws.max_row, \"rows\")\n","python",[14,63,64,80,87,99,110,121,126,154,184,255,260,272],{"__ignoreMap":35},[39,65,66,70,74,77],{"class":41,"line":42},[39,67,69],{"class":68},"szBVR","from",[39,71,73],{"class":72},"sVt8B"," openpyxl ",[39,75,76],{"class":68},"import",[39,78,79],{"class":72}," Workbook\n",[39,81,83],{"class":41,"line":82},2,[39,84,86],{"emptyLinePlaceholder":85},true,"\n",[39,88,90,93,96],{"class":41,"line":89},3,[39,91,92],{"class":72},"wb ",[39,94,95],{"class":68},"=",[39,97,98],{"class":72}," Workbook()\n",[39,100,102,105,107],{"class":41,"line":101},4,[39,103,104],{"class":72},"ws ",[39,106,95],{"class":68},[39,108,109],{"class":72}," wb.active\n",[39,111,113,116,118],{"class":41,"line":112},5,[39,114,115],{"class":72},"ws.title ",[39,117,95],{"class":68},[39,119,120],{"class":49}," \"Ledger\"\n",[39,122,124],{"class":41,"line":123},6,[39,125,86],{"emptyLinePlaceholder":85},[39,127,129,132,135,138,141,143,146,148,151],{"class":41,"line":128},7,[39,130,131],{"class":72},"ws.append([",[39,133,134],{"class":49},"\"Date\"",[39,136,137],{"class":72},", ",[39,139,140],{"class":49},"\"Account\"",[39,142,137],{"class":72},[39,144,145],{"class":49},"\"Description\"",[39,147,137],{"class":72},[39,149,150],{"class":49},"\"Amount\"",[39,152,153],{"class":72},"])\n",[39,155,157,160,163,166,170,173,176,178,181],{"class":41,"line":156},8,[39,158,159],{"class":68},"for",[39,161,162],{"class":72}," i ",[39,164,165],{"class":68},"in",[39,167,169],{"class":168},"sj4cs"," range",[39,171,172],{"class":72},"(",[39,174,175],{"class":168},"1",[39,177,137],{"class":72},[39,179,180],{"class":168},"41",[39,182,183],{"class":72},"):\n",[39,185,187,190,193,196,199,202,205,208,211,213,215,218,220,222,225,227,229,231,233,236,238,240,242,244,247,250,253],{"class":41,"line":186},9,[39,188,189],{"class":72},"    ws.append([",[39,191,192],{"class":68},"f",[39,194,195],{"class":49},"\"2024-08-",[39,197,198],{"class":168},"{",[39,200,201],{"class":72},"i",[39,203,204],{"class":68},":02d",[39,206,207],{"class":168},"}",[39,209,210],{"class":49},"\"",[39,212,137],{"class":72},[39,214,192],{"class":68},[39,216,217],{"class":49},"\"ACC-",[39,219,198],{"class":168},[39,221,201],{"class":72},[39,223,224],{"class":68},":03d",[39,226,207],{"class":168},[39,228,210],{"class":49},[39,230,137],{"class":72},[39,232,192],{"class":68},[39,234,235],{"class":49},"\"Entry ",[39,237,198],{"class":168},[39,239,201],{"class":72},[39,241,207],{"class":168},[39,243,210],{"class":49},[39,245,246],{"class":72},", i ",[39,248,249],{"class":68},"*",[39,251,252],{"class":168}," 100",[39,254,153],{"class":72},[39,256,258],{"class":41,"line":257},10,[39,259,86],{"emptyLinePlaceholder":85},[39,261,263,266,269],{"class":41,"line":262},11,[39,264,265],{"class":72},"wb.save(",[39,267,268],{"class":49},"\"frozen_report.xlsx\"",[39,270,271],{"class":72},")\n",[39,273,275,278,280,283,286,289],{"class":41,"line":274},12,[39,276,277],{"class":168},"print",[39,279,172],{"class":72},[39,281,282],{"class":49},"\"Sample workbook created with\"",[39,284,285],{"class":72},", ws.max_row, ",[39,287,288],{"class":49},"\"rows\"",[39,290,271],{"class":72},[25,292,294],{"id":293},"freeze-the-header-row","Freeze the header row",[10,296,297,298,300,301,305,306,309,310,313],{},"Set ",[14,299,16],{}," to the cell ",[302,303,304],"strong",{},"below"," the rows you want frozen and ",[302,307,308],{},"right"," of the columns you want frozen. To freeze just row 1, anchor at ",[14,311,312],{},"\"A2\""," — everything above row 2 (that is, row 1) stays pinned:",[30,315,317],{"className":59,"code":316,"language":61,"meta":35,"style":35},"from openpyxl import load_workbook\n\nwb = load_workbook(\"frozen_report.xlsx\")\nws = wb[\"Ledger\"]\n\nws.freeze_panes = \"A2\"   # row 1 stays visible while scrolling\n\nwb.save(\"frozen_report.xlsx\")\nprint(\"Header row frozen\")\n",[14,318,319,330,334,347,362,366,380,384,392],{"__ignoreMap":35},[39,320,321,323,325,327],{"class":41,"line":42},[39,322,69],{"class":68},[39,324,73],{"class":72},[39,326,76],{"class":68},[39,328,329],{"class":72}," load_workbook\n",[39,331,332],{"class":41,"line":82},[39,333,86],{"emptyLinePlaceholder":85},[39,335,336,338,340,343,345],{"class":41,"line":89},[39,337,92],{"class":72},[39,339,95],{"class":68},[39,341,342],{"class":72}," load_workbook(",[39,344,268],{"class":49},[39,346,271],{"class":72},[39,348,349,351,353,356,359],{"class":41,"line":101},[39,350,104],{"class":72},[39,352,95],{"class":68},[39,354,355],{"class":72}," wb[",[39,357,358],{"class":49},"\"Ledger\"",[39,360,361],{"class":72},"]\n",[39,363,364],{"class":41,"line":112},[39,365,86],{"emptyLinePlaceholder":85},[39,367,368,371,373,376],{"class":41,"line":123},[39,369,370],{"class":72},"ws.freeze_panes ",[39,372,95],{"class":68},[39,374,375],{"class":49}," \"A2\"",[39,377,379],{"class":378},"sJ8bj","   # row 1 stays visible while scrolling\n",[39,381,382],{"class":41,"line":128},[39,383,86],{"emptyLinePlaceholder":85},[39,385,386,388,390],{"class":41,"line":156},[39,387,265],{"class":72},[39,389,268],{"class":49},[39,391,271],{"class":72},[39,393,394,396,398,401],{"class":41,"line":186},[39,395,277],{"class":168},[39,397,172],{"class":72},[39,399,400],{"class":49},"\"Header row frozen\"",[39,402,271],{"class":72},[25,404,406],{"id":405},"how-the-anchor-cell-works","How the anchor cell works",[10,408,409,410,413],{},"The anchor is the ",[302,411,412],{},"top-left cell of the unfrozen (scrolling) region",". Everything above it freezes, and everything to its left freezes. Read it as \"freeze up to here\":",[415,416,417,433],"table",{},[418,419,420],"thead",{},[421,422,423,427,430],"tr",{},[424,425,426],"th",{},"Anchor",[424,428,429],{},"Frozen",[424,431,432],{},"Use case",[434,435,436,449,462,479,492],"tbody",{},[421,437,438,443,446],{},[439,440,441],"td",{},[14,442,312],{},[439,444,445],{},"Row 1",[439,447,448],{},"Pin the header row",[421,450,451,456,459],{},[439,452,453],{},[14,454,455],{},"\"B1\"",[439,457,458],{},"Column A",[439,460,461],{},"Pin a label column",[421,463,464,469,476],{},[439,465,466],{},[14,467,468],{},"\"B2\"",[439,470,471,472,475],{},"Row 1 ",[302,473,474],{},"and"," column A",[439,477,478],{},"Pin both at once",[421,480,481,486,489],{},[439,482,483],{},[14,484,485],{},"\"C2\"",[439,487,488],{},"Row 1 and columns A–B",[439,490,491],{},"Pin a header plus two label columns",[421,493,494,499,502],{},[439,495,496],{},[14,497,498],{},"None",[439,500,501],{},"Nothing",[439,503,504],{},"Remove all freezing",[10,506,507],{},"So the digit in the anchor is one greater than the last frozen row, and the letter is one greater than the last frozen column.",[25,509,511],{"id":510},"freeze-the-first-column","Freeze the first column",[10,513,514],{},"To keep a label column visible while scrolling sideways, anchor in column B of row 1:",[30,516,518],{"className":59,"code":517,"language":61,"meta":35,"style":35},"from openpyxl import load_workbook\n\nwb = load_workbook(\"frozen_report.xlsx\")\nws = wb[\"Ledger\"]\n\nws.freeze_panes = \"B1\"   # column A stays visible while scrolling right\n\nwb.save(\"frozen_report.xlsx\")\nprint(\"First column frozen\")\n",[14,519,520,530,534,546,558,562,574,578,586],{"__ignoreMap":35},[39,521,522,524,526,528],{"class":41,"line":42},[39,523,69],{"class":68},[39,525,73],{"class":72},[39,527,76],{"class":68},[39,529,329],{"class":72},[39,531,532],{"class":41,"line":82},[39,533,86],{"emptyLinePlaceholder":85},[39,535,536,538,540,542,544],{"class":41,"line":89},[39,537,92],{"class":72},[39,539,95],{"class":68},[39,541,342],{"class":72},[39,543,268],{"class":49},[39,545,271],{"class":72},[39,547,548,550,552,554,556],{"class":41,"line":101},[39,549,104],{"class":72},[39,551,95],{"class":68},[39,553,355],{"class":72},[39,555,358],{"class":49},[39,557,361],{"class":72},[39,559,560],{"class":41,"line":112},[39,561,86],{"emptyLinePlaceholder":85},[39,563,564,566,568,571],{"class":41,"line":123},[39,565,370],{"class":72},[39,567,95],{"class":68},[39,569,570],{"class":49}," \"B1\"",[39,572,573],{"class":378},"   # column A stays visible while scrolling right\n",[39,575,576],{"class":41,"line":128},[39,577,86],{"emptyLinePlaceholder":85},[39,579,580,582,584],{"class":41,"line":156},[39,581,265],{"class":72},[39,583,268],{"class":49},[39,585,271],{"class":72},[39,587,588,590,592,595],{"class":41,"line":186},[39,589,277],{"class":168},[39,591,172],{"class":72},[39,593,594],{"class":49},"\"First column frozen\"",[39,596,271],{"class":72},[25,598,600],{"id":599},"freeze-both-the-header-row-and-the-first-column","Freeze both the header row and the first column",[10,602,603,604,606],{},"Anchoring at ",[14,605,468],{}," freezes row 1 and column A together — the most common layout for a wide, tall report where you scroll in both directions:",[30,608,610],{"className":59,"code":609,"language":61,"meta":35,"style":35},"from openpyxl import load_workbook\n\nwb = load_workbook(\"frozen_report.xlsx\")\nws = wb[\"Ledger\"]\n\nws.freeze_panes = \"B2\"   # row 1 and column A both pinned\n\nwb.save(\"frozen_report.xlsx\")\nprint(\"Header row and first column frozen\")\n",[14,611,612,622,626,638,650,654,666,670,678],{"__ignoreMap":35},[39,613,614,616,618,620],{"class":41,"line":42},[39,615,69],{"class":68},[39,617,73],{"class":72},[39,619,76],{"class":68},[39,621,329],{"class":72},[39,623,624],{"class":41,"line":82},[39,625,86],{"emptyLinePlaceholder":85},[39,627,628,630,632,634,636],{"class":41,"line":89},[39,629,92],{"class":72},[39,631,95],{"class":68},[39,633,342],{"class":72},[39,635,268],{"class":49},[39,637,271],{"class":72},[39,639,640,642,644,646,648],{"class":41,"line":101},[39,641,104],{"class":72},[39,643,95],{"class":68},[39,645,355],{"class":72},[39,647,358],{"class":49},[39,649,361],{"class":72},[39,651,652],{"class":41,"line":112},[39,653,86],{"emptyLinePlaceholder":85},[39,655,656,658,660,663],{"class":41,"line":123},[39,657,370],{"class":72},[39,659,95],{"class":68},[39,661,662],{"class":49}," \"B2\"",[39,664,665],{"class":378},"   # row 1 and column A both pinned\n",[39,667,668],{"class":41,"line":128},[39,669,86],{"emptyLinePlaceholder":85},[39,671,672,674,676],{"class":41,"line":156},[39,673,265],{"class":72},[39,675,268],{"class":49},[39,677,271],{"class":72},[39,679,680,682,684,687],{"class":41,"line":186},[39,681,277],{"class":168},[39,683,172],{"class":72},[39,685,686],{"class":49},"\"Header row and first column frozen\"",[39,688,271],{"class":72},[25,690,692],{"id":691},"remove-the-freeze","Remove the freeze",[10,694,695,696,699],{},"Setting ",[14,697,698],{},"ws.freeze_panes = None"," clears any frozen panes so the whole sheet scrolls freely again:",[30,701,703],{"className":59,"code":702,"language":61,"meta":35,"style":35},"from openpyxl import load_workbook\n\nwb = load_workbook(\"frozen_report.xlsx\")\nws = wb[\"Ledger\"]\n\nws.freeze_panes = None   # unfreeze everything\n\nwb.save(\"frozen_report.xlsx\")\nprint(\"Freeze removed\")\n",[14,704,705,715,719,731,743,747,759,763,771],{"__ignoreMap":35},[39,706,707,709,711,713],{"class":41,"line":42},[39,708,69],{"class":68},[39,710,73],{"class":72},[39,712,76],{"class":68},[39,714,329],{"class":72},[39,716,717],{"class":41,"line":82},[39,718,86],{"emptyLinePlaceholder":85},[39,720,721,723,725,727,729],{"class":41,"line":89},[39,722,92],{"class":72},[39,724,95],{"class":68},[39,726,342],{"class":72},[39,728,268],{"class":49},[39,730,271],{"class":72},[39,732,733,735,737,739,741],{"class":41,"line":101},[39,734,104],{"class":72},[39,736,95],{"class":68},[39,738,355],{"class":72},[39,740,358],{"class":49},[39,742,361],{"class":72},[39,744,745],{"class":41,"line":112},[39,746,86],{"emptyLinePlaceholder":85},[39,748,749,751,753,756],{"class":41,"line":123},[39,750,370],{"class":72},[39,752,95],{"class":68},[39,754,755],{"class":168}," None",[39,757,758],{"class":378},"   # unfreeze everything\n",[39,760,761],{"class":41,"line":128},[39,762,86],{"emptyLinePlaceholder":85},[39,764,765,767,769],{"class":41,"line":156},[39,766,265],{"class":72},[39,768,268],{"class":49},[39,770,271],{"class":72},[39,772,773,775,777,780],{"class":41,"line":186},[39,774,277],{"class":168},[39,776,172],{"class":72},[39,778,779],{"class":49},"\"Freeze removed\"",[39,781,271],{"class":72},[25,783,785],{"id":784},"freeze-panes-on-every-sheet","Freeze panes on every sheet",[10,787,788,791,792,795],{},[14,789,790],{},"freeze_panes"," is a per-worksheet attribute, so a multi-sheet workbook needs it set on each sheet you want pinned. Loop over ",[14,793,794],{},"wb.worksheets",":",[30,797,799],{"className":59,"code":798,"language":61,"meta":35,"style":35},"from openpyxl import load_workbook\n\nwb = load_workbook(\"frozen_report.xlsx\")\n\nfor sheet in wb.worksheets:\n    sheet.freeze_panes = \"A2\"   # header row on every sheet\n\nwb.save(\"frozen_report.xlsx\")\nprint(\"Froze the header on\", len(wb.worksheets), \"sheet(s)\")\n",[14,800,801,811,815,827,831,843,855,859,867],{"__ignoreMap":35},[39,802,803,805,807,809],{"class":41,"line":42},[39,804,69],{"class":68},[39,806,73],{"class":72},[39,808,76],{"class":68},[39,810,329],{"class":72},[39,812,813],{"class":41,"line":82},[39,814,86],{"emptyLinePlaceholder":85},[39,816,817,819,821,823,825],{"class":41,"line":89},[39,818,92],{"class":72},[39,820,95],{"class":68},[39,822,342],{"class":72},[39,824,268],{"class":49},[39,826,271],{"class":72},[39,828,829],{"class":41,"line":101},[39,830,86],{"emptyLinePlaceholder":85},[39,832,833,835,838,840],{"class":41,"line":112},[39,834,159],{"class":68},[39,836,837],{"class":72}," sheet ",[39,839,165],{"class":68},[39,841,842],{"class":72}," wb.worksheets:\n",[39,844,845,848,850,852],{"class":41,"line":123},[39,846,847],{"class":72},"    sheet.freeze_panes ",[39,849,95],{"class":68},[39,851,375],{"class":49},[39,853,854],{"class":378},"   # header row on every sheet\n",[39,856,857],{"class":41,"line":128},[39,858,86],{"emptyLinePlaceholder":85},[39,860,861,863,865],{"class":41,"line":156},[39,862,265],{"class":72},[39,864,268],{"class":49},[39,866,271],{"class":72},[39,868,869,871,873,876,878,881,884,887],{"class":41,"line":186},[39,870,277],{"class":168},[39,872,172],{"class":72},[39,874,875],{"class":49},"\"Froze the header on\"",[39,877,137],{"class":72},[39,879,880],{"class":168},"len",[39,882,883],{"class":72},"(wb.worksheets), ",[39,885,886],{"class":49},"\"sheet(s)\"",[39,888,271],{"class":72},[25,890,892],{"id":891},"common-pitfalls","Common pitfalls",[415,894,895,908],{},[418,896,897],{},[421,898,899,902,905],{},[424,900,901],{},"Symptom",[424,903,904],{},"Cause",[424,906,907],{},"Fix",[434,909,910,929,944,959,976],{},[421,911,912,915,921],{},[439,913,914],{},"Header still scrolls away",[439,916,917,918],{},"Anchored at ",[14,919,920],{},"\"A1\"",[439,922,923,925,926,928],{},[14,924,920],{}," freezes nothing; use ",[14,927,312],{}," to pin row 1",[421,930,931,934,937],{},[439,932,933],{},"Two header rows wanted, only one frozen",[439,935,936],{},"Off-by-one anchor",[439,938,939,940,943],{},"Anchor below the last header row: ",[14,941,942],{},"\"A3\""," freezes rows 1–2",[421,945,946,949,954],{},[439,947,948],{},"Freeze missing on some tabs",[439,950,951,953],{},[14,952,790],{}," is per worksheet",[439,955,956,957],{},"Set it on every sheet, e.g. loop ",[14,958,794],{},[421,960,961,964,967],{},[439,962,963],{},"Froze the wrong column",[439,965,966],{},"Letter is one past the last frozen column",[439,968,969,971,972,975],{},[14,970,455],{}," freezes column A; ",[14,973,974],{},"\"C1\""," freezes A–B",[421,977,978,981,984],{},[439,979,980],{},"Freeze ignored after a pandas write",[439,982,983],{},"pandas overwrote the sheet",[439,985,986,987,989],{},"Apply ",[14,988,790],{}," after the pandas export, reopening with openpyxl",[25,991,993],{"id":992},"a-note-on-scale","A note on scale",[10,995,996],{},"Freezing is metadata on the worksheet, not per-cell data, so it costs nothing as the sheet grows — a 1,000,000-row export freezes its header just as cheaply as a 10-row one. There is no performance reason to skip it on large reports.",[25,998,1000],{"id":999},"frequently-asked-questions","Frequently asked questions",[10,1002,1003,1006,1008,1009,1011],{},[302,1004,1005],{},"Which cell do I anchor to freeze the header row?",[14,1007,312],{},". The anchor is the first scrolling cell, so everything above it — row 1 — stays frozen. ",[14,1010,920],{}," freezes nothing.",[10,1013,1014,1017,1018,1020,1021,1023],{},[302,1015,1016],{},"How do I freeze the top two rows?","\nAnchor at ",[14,1019,942],{},". The row digit is always one greater than the last row you want frozen, so ",[14,1022,942],{}," pins rows 1 and 2.",[10,1025,1026,1029,1030,1032],{},[302,1027,1028],{},"Can I freeze a row and a column at the same time?","\nYes. Anchor at the intersection of the first scrolling row and column. ",[14,1031,468],{}," freezes row 1 and column A together.",[10,1034,1035,1038,1040,1041,1043],{},[302,1036,1037],{},"Why is the freeze only on one sheet?",[14,1039,790],{}," is set per worksheet. Iterate ",[14,1042,794],{}," and assign it to each sheet that needs a pinned header.",[10,1045,1046,1049,1050,1052],{},[302,1047,1048],{},"How do I remove a freeze?","\nSet ",[14,1051,698],{}," and save. That clears all frozen panes and the sheet scrolls normally again.",[25,1054,1056],{"id":1055},"conclusion","Conclusion",[10,1058,1059,1060,1062,1063,1065,1066,1068,1069,1071,1072,1074],{},"Freezing panes in openpyxl is one line: ",[14,1061,16],{}," set to the top-left cell of the scrolling region. ",[14,1064,312],{}," pins the header row, ",[14,1067,455],{}," pins the first column, ",[14,1070,468],{}," pins both, and ",[14,1073,498],{}," clears it. Remember the anchor is one row below and one column right of what you want frozen, and that the attribute lives on each worksheet — so loop your sheets when a workbook has several.",[25,1076,1078],{"id":1077},"where-to-go-next","Where to go next",[1080,1081,1082,1088,1095],"ul",{},[1083,1084,1085,1087],"li",{},[19,1086,22],{"href":21}," — the parent cluster on fonts, fills, borders, and alignment.",[1083,1089,1090,1094],{},[19,1091,1093],{"href":1092},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fstyling-excel-cells-with-openpyxl\u002Fset-column-width-and-row-height-in-openpyxl\u002F","Set Column Width and Row Height in openpyxl"," — size the columns whose headers you just froze.",[1083,1096,1097,1101,1102,1104],{},[19,1098,1100],{"href":1099},"\u002Fgetting-started-with-python-excel-automation\u002Fusing-openpyxl-for-excel-file-manipulation\u002F","Using openpyxl for Excel File Manipulation"," — the workbook fundamentals behind ",[14,1103,790],{},".",[1106,1107,1108],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}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 .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}",{"title":35,"searchDepth":82,"depth":82,"links":1110},[1111,1112,1113,1114,1115,1116,1117,1118,1119,1120,1121,1122],{"id":27,"depth":82,"text":28},{"id":293,"depth":82,"text":294},{"id":405,"depth":82,"text":406},{"id":510,"depth":82,"text":511},{"id":599,"depth":82,"text":600},{"id":691,"depth":82,"text":692},{"id":784,"depth":82,"text":785},{"id":891,"depth":82,"text":892},{"id":992,"depth":82,"text":993},{"id":999,"depth":82,"text":1000},{"id":1055,"depth":82,"text":1056},{"id":1077,"depth":82,"text":1078},"Freeze the header row in Excel from Python with openpyxl using ws.freeze_panes. Freeze rows, columns, or both, understand the anchor cell, and unfreeze — runnable.","md",{},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fstyling-excel-cells-with-openpyxl\u002Ffreeze-header-row-in-excel-with-openpyxl",{"title":1128,"description":1129},"Freeze Header Row in openpyxl","Freeze Excel panes in Python with openpyxl: ws.freeze_panes='A2' for the header row, freeze columns, freeze both, the anchor-cell rule, and how to unfreeze.","formatting-and-charting-excel-reports-with-python\u002Fstyling-excel-cells-with-openpyxl\u002Ffreeze-header-row-in-excel-with-openpyxl\u002Findex","Mo-R-I-wo9tw14mKDmXJmusU_3-1brQKxjsWOk4odGw",[1133,1136],{"title":22,"path":1134,"stem":1135,"children":-1},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fstyling-excel-cells-with-openpyxl","formatting-and-charting-excel-reports-with-python\u002Fstyling-excel-cells-with-openpyxl\u002Findex",{"title":1093,"path":1137,"stem":1138,"children":-1},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fstyling-excel-cells-with-openpyxl\u002Fset-column-width-and-row-height-in-openpyxl","formatting-and-charting-excel-reports-with-python\u002Fstyling-excel-cells-with-openpyxl\u002Fset-column-width-and-row-height-in-openpyxl\u002Findex",1781773161047]