[{"data":1,"prerenderedAt":1860},["ShallowReactive",2],{"doc:\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-read-excel-returning-an-empty-dataframe":3,"surround:\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-read-excel-returning-an-empty-dataframe":1824,"ancestors:\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-read-excel-returning-an-empty-dataframe":1833,"children:\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-read-excel-returning-an-empty-dataframe":1838,"related:\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-read-excel-returning-an-empty-dataframe":1839},{"id":4,"title":5,"body":6,"dateModified":1790,"datePublished":1790,"description":1791,"extension":1792,"faq":1793,"keyword":1802,"kind":1803,"meta":1804,"navigation":112,"path":1813,"seo":1814,"slug":1817,"stem":1818,"topics":1819,"type":1822,"__hash__":1823},"docs\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-read-excel-returning-an-empty-dataframe\u002Findex.md","Fix read_excel Returning an Empty DataFrame",{"type":7,"value":8,"toc":1778},"minimark",[9,31,36,64,80,84,182,215,219,330,371,621,625,886,917,1030,1170,1174,1177,1588,1611,1615,1630,1634,1678,1682,1713,1717,1723,1729,1735,1741,1745,1774],[10,11,12,16,17,20,21,24,25,30],"p",{},[13,14,15],"code",{},"pd.read_excel(\"report.xlsx\")"," runs without an error and returns ",[13,18,19],{},"Empty DataFrame",", or a frame with the right columns and no rows, or the right shape filled with ",[13,22,23],{},"NaN"," — while the file, opened in Excel, plainly contains data. No exception means no message pointing at the cause, so people try arguments at random. There are only a handful of causes, though, and each leaves a recognisable signature: which sheet was read, how many columns came back, whether the header is right, whether values are missing or the rows themselves are. This page reproduces each cause on one workbook, explains the signature, and builds a small diagnostic that inspects the file with openpyxl and says where the data actually is. It belongs to ",[26,27,29],"a",{"href":28},"\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002F","Troubleshooting Common Python Excel Errors",".",[32,33,35],"h2",{"id":34},"prerequisites","Prerequisites",[37,38,43],"pre",{"className":39,"code":40,"language":41,"meta":42,"style":42},"language-bash shiki shiki-themes github-light github-dark-high-contrast","pip install pandas openpyxl\n","bash","",[13,44,45],{"__ignoreMap":42},[46,47,50,54,58,61],"span",{"class":48,"line":49},"line",1,[46,51,53],{"class":52},"sMTad","pip",[46,55,57],{"class":56},"srMev"," install",[46,59,60],{"class":56}," pandas",[46,62,63],{"class":56}," openpyxl\n",[10,65,66,67,71,72,75,76,79],{},"The sample workbook deliberately has the shapes that cause trouble in real files: an empty ",[68,69,70],"em",{},"Cover"," sheet first, a ",[68,73,74],{},"Sales data"," sheet whose table starts on row 4 under a title and a note and ends with a totals row, and a ",[68,77,78],{},"Calc"," sheet of formulas written by Python and never opened in Excel.",[32,81,83],{"id":82},"step-1-the-wrong-sheet","Step 1 — The wrong sheet",[37,85,89],{"className":86,"code":87,"language":88,"meta":42,"style":42},"language-python shiki shiki-themes github-light github-dark-high-contrast","import pandas as pd\n\ndf = pd.read_excel(\"report.xlsx\")\nprint(df.shape, \"| columns:\", list(df.columns))\nwith pd.ExcelFile(\"report.xlsx\") as xf:\n    print(xf.sheet_names)\n","python",[13,90,91,107,114,132,154,173],{"__ignoreMap":42},[46,92,93,97,101,104],{"class":48,"line":49},[46,94,96],{"class":95},"s-kum","import",[46,98,100],{"class":99},"skGVy"," pandas ",[46,102,103],{"class":95},"as",[46,105,106],{"class":99}," pd\n",[46,108,110],{"class":48,"line":109},2,[46,111,113],{"emptyLinePlaceholder":112},true,"\n",[46,115,117,120,123,126,129],{"class":48,"line":116},3,[46,118,119],{"class":99},"df ",[46,121,122],{"class":95},"=",[46,124,125],{"class":99}," pd.read_excel(",[46,127,128],{"class":56},"\"report.xlsx\"",[46,130,131],{"class":99},")\n",[46,133,135,139,142,145,148,151],{"class":48,"line":134},4,[46,136,138],{"class":137},"sP0c6","print",[46,140,141],{"class":99},"(df.shape, ",[46,143,144],{"class":56},"\"| columns:\"",[46,146,147],{"class":99},", ",[46,149,150],{"class":137},"list",[46,152,153],{"class":99},"(df.columns))\n",[46,155,157,160,163,165,168,170],{"class":48,"line":156},5,[46,158,159],{"class":95},"with",[46,161,162],{"class":99}," pd.ExcelFile(",[46,164,128],{"class":56},[46,166,167],{"class":99},") ",[46,169,103],{"class":95},[46,171,172],{"class":99}," xf:\n",[46,174,176,179],{"class":48,"line":175},6,[46,177,178],{"class":137},"    print",[46,180,181],{"class":99},"(xf.sheet_names)\n",[10,183,184,187,188,191,192,195,196,200,201,204,205,147,207,210,211,214],{},[13,185,186],{},"read_excel"," reads the ",[68,189,190],{},"first"," sheet unless told otherwise, and here the first sheet is an empty cover page, so the result is an empty frame with no columns. Listing the sheet names with ",[13,193,194],{},"pd.ExcelFile(...).sheet_names"," shows where the data is — or, to see each sheet's header without loading anything, use the approach in ",[26,197,199],{"href":198},"\u002Fgetting-started-with-python-excel-automation\u002Freading-excel-files-with-pandas\u002Flist-sheet-names-and-column-headers-without-loading-data\u002F","List Sheet Names and Column Headers Without Loading the Data","; pass the name with ",[13,202,203],{},"sheet_name=\"Sales data\"",". Reading by name rather than by position also protects the script when someone adds a sheet in front. If the sheet name itself varies — ",[68,206,74],{},[68,208,209],{},"Sales Data (2)"," — match it from the list with a case-insensitive comparison instead of typing it, and fail with the list of available names when nothing matches. Signature: ",[68,212,213],{},"shape (0, 0)"," and no error.",[32,216,218],{"id":217},"step-2-the-header-is-not-on-the-first-row","Step 2 — The header is not on the first row",[37,220,222],{"className":86,"code":221,"language":88,"meta":42,"style":42},"raw = pd.read_excel(\"report.xlsx\", sheet_name=\"Sales data\")\nprint(raw.shape, list(raw.columns)[:2])\nprint(pd.read_excel(\"report.xlsx\", sheet_name=\"Sales data\", skiprows=10).shape)\nprint(pd.read_excel(\"report.xlsx\", sheet_name=\"Sales data\", header=3).head(2).to_string())\n",[13,223,224,248,266,296],{"__ignoreMap":42},[46,225,226,229,231,233,235,237,241,243,246],{"class":48,"line":49},[46,227,228],{"class":99},"raw ",[46,230,122],{"class":95},[46,232,125],{"class":99},[46,234,128],{"class":56},[46,236,147],{"class":99},[46,238,240],{"class":239},"sa561","sheet_name",[46,242,122],{"class":95},[46,244,245],{"class":56},"\"Sales data\"",[46,247,131],{"class":99},[46,249,250,252,255,257,260,263],{"class":48,"line":109},[46,251,138],{"class":137},[46,253,254],{"class":99},"(raw.shape, ",[46,256,150],{"class":137},[46,258,259],{"class":99},"(raw.columns)[:",[46,261,262],{"class":137},"2",[46,264,265],{"class":99},"])\n",[46,267,268,270,273,275,277,279,281,283,285,288,290,293],{"class":48,"line":116},[46,269,138],{"class":137},[46,271,272],{"class":99},"(pd.read_excel(",[46,274,128],{"class":56},[46,276,147],{"class":99},[46,278,240],{"class":239},[46,280,122],{"class":95},[46,282,245],{"class":56},[46,284,147],{"class":99},[46,286,287],{"class":239},"skiprows",[46,289,122],{"class":95},[46,291,292],{"class":137},"10",[46,294,295],{"class":99},").shape)\n",[46,297,298,300,302,304,306,308,310,312,314,317,319,322,325,327],{"class":48,"line":134},[46,299,138],{"class":137},[46,301,272],{"class":99},[46,303,128],{"class":56},[46,305,147],{"class":99},[46,307,240],{"class":239},[46,309,122],{"class":95},[46,311,245],{"class":56},[46,313,147],{"class":99},[46,315,316],{"class":239},"header",[46,318,122],{"class":95},[46,320,321],{"class":137},"3",[46,323,324],{"class":99},").head(",[46,326,262],{"class":137},[46,328,329],{"class":99},").to_string())\n",[10,331,332,333,336,337,340,341,344,345,348,349,351,352,355,356,359,360,363,364,366,367,30],{},"Read without arguments, the title in A1 becomes the only column name and the real header ends up as a data row — a frame with the wrong columns and ",[68,334,335],{},"Unnamed"," labels rather than an empty one. Overshooting in the other direction is what produces an empty result: ",[13,338,339],{},"skiprows=10"," skips past every data row, leaving nothing. ",[13,342,343],{},"header=3"," — the zero-based row index of the header, so Excel row 4 — gives the right columns and data. ",[13,346,347],{},"skiprows=3"," achieves the same here by skipping the three rows above the header, after which the next row is used as the header; the two differ only when blank rows are involved, because ",[13,350,316],{}," counts rows as they appear in the sheet. Notice that ",[68,353,354],{},"Units"," reads as ",[13,357,358],{},"120.0"," rather than ",[13,361,362],{},"120",": the totals row further down holds a formula without a saved result, which puts ",[13,365,23],{}," in the column and forces it to floats — one more reason to trim the footer, as the next step does. When the header row varies between files, find it rather than hard-coding it, as the diagnostic in Step 4 does and as covered in ",[26,368,370],{"href":369},"\u002Fgetting-started-with-python-excel-automation\u002Freading-excel-files-with-pandas\u002Fskip-rows-and-set-header-when-reading-excel-with-pandas\u002F","Skip Rows and Set the Header When Reading Excel with pandas",[372,373,381,382,381,386,381,390,381,398,381,407,381,411,381,418,381,422,381,426,381,430,381,434,381,437,381,441,381,445,381,450,381,453,381,457,381,459,381,461,381,463,381,466,381,469,381,471,381,475,381,477,381,479,381,481,381,484,381,487,381,489,381,491,381,493,381,495,381,498,381,502,381,506,381,510,381,512,381,515,381,517,381,519,381,521,381,524,381,527,381,531,381,533,381,536,381,538,381,541,381,543,381,545,381,547,381,550,381,553,381,557,381,559,381,562,381,564,381,567,381,569,381,572,381,574,381,577,381,580,381,584,381,586,381,589,381,591,381,593,381,595,381,598,381,602,381,606,381,610,381,612,381,614,381,617,381,619],"svg",{"viewBox":374,"role":375,"ariaLabelledBy":376,"xmlns":379,"style":380},"98 0 563 280","img",[377,378],"re-sheet-t","re-sheet-d","http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg","width:100%;max-width:563px;height:auto;display:block;margin:1.5rem auto;font-family:Inter,ui-sans-serif,system-ui,sans-serif","\n  ",[383,384,385],"title",{"id":377},"The Sales data sheet",[387,388,389],"desc",{"id":378},"A title in row 1 and a note in row 2, an empty row 3, the header in row 4, four data rows in rows 5 to 8, an empty row and a totals row in row 10. header=3 points at row 4; skiprows=10 skips past all the data.",[391,392],"rect",{"x":393,"y":394,"width":395,"height":396,"fill":397},"98","0","563","280","#ffffff",[391,399],{"x":400,"y":401,"width":402,"height":403,"rx":394,"fill":404,"stroke":405,"style":406},"114.8","16.0","32.0","24.0","#e7ebef","var(--line,#cdd5e6)","stroke-width:1px",[391,408],{"x":409,"y":401,"width":410,"height":403,"rx":394,"fill":404,"stroke":405,"style":406},"146.8","257.8",[412,413,417],"text",{"x":414,"y":415,"style":416},"275.7","33.0","font-size:11px;font-weight:600;fill:var(--muted,#5b6780);text-anchor:middle","A",[391,419],{"x":420,"y":401,"width":421,"height":403,"rx":394,"fill":404,"stroke":405,"style":406},"404.6","72.8",[412,423,425],{"x":424,"y":415,"style":416},"441.0","B",[391,427],{"x":428,"y":401,"width":429,"height":403,"rx":394,"fill":404,"stroke":405,"style":406},"477.4","83.9",[412,431,433],{"x":432,"y":415,"style":416},"519.4","C",[391,435],{"x":436,"y":401,"width":429,"height":403,"rx":394,"fill":404,"stroke":405,"style":406},"561.3",[412,438,440],{"x":439,"y":415,"style":416},"603.3","D",[391,442],{"x":400,"y":443,"width":402,"height":444,"rx":394,"fill":404,"stroke":405,"style":406},"40.0","28.0",[412,446,449],{"x":447,"y":448,"style":416},"130.8","59.0","1",[391,451],{"x":409,"y":443,"width":410,"height":444,"rx":394,"fill":404,"stroke":405,"style":452},"stroke-width:1.5px",[412,454,456],{"x":414,"y":448,"style":455},"font-size:12px;font-weight:700;fill:var(--text,#172033);text-anchor:middle","Sales export — generated 2026-10-01",[391,458],{"x":420,"y":443,"width":421,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[391,460],{"x":428,"y":443,"width":429,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[391,462],{"x":436,"y":443,"width":429,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[391,464],{"x":400,"y":465,"width":402,"height":444,"rx":394,"fill":404,"stroke":405,"style":406},"68.0",[412,467,262],{"x":447,"y":468,"style":416},"87.0",[391,470],{"x":409,"y":465,"width":410,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[412,472,474],{"x":414,"y":468,"style":473},"font-size:12px;font-weight:400;fill:var(--text,#172033);text-anchor:middle","Confidential",[391,476],{"x":420,"y":465,"width":421,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[391,478],{"x":428,"y":465,"width":429,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[391,480],{"x":436,"y":465,"width":429,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[391,482],{"x":400,"y":483,"width":402,"height":444,"rx":394,"fill":404,"stroke":405,"style":406},"96.0",[412,485,321],{"x":447,"y":486,"style":416},"115.0",[391,488],{"x":409,"y":483,"width":410,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[391,490],{"x":420,"y":483,"width":421,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[391,492],{"x":428,"y":483,"width":429,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[391,494],{"x":436,"y":483,"width":429,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[391,496],{"x":400,"y":497,"width":402,"height":444,"rx":394,"fill":404,"stroke":405,"style":406},"124.0",[412,499,501],{"x":447,"y":500,"style":416},"143.0","4",[391,503],{"x":409,"y":497,"width":410,"height":444,"rx":394,"fill":504,"stroke":505,"style":452},"#d9f4f1","var(--teal,#0f9488)",[412,507,509],{"x":414,"y":500,"style":508},"font-size:12px;font-weight:700;fill:var(--teal-ink,#0b6157);text-anchor:middle","Region",[391,511],{"x":420,"y":497,"width":421,"height":444,"rx":394,"fill":504,"stroke":505,"style":452},[412,513,514],{"x":424,"y":500,"style":508},"Product",[391,516],{"x":428,"y":497,"width":429,"height":444,"rx":394,"fill":504,"stroke":505,"style":452},[412,518,354],{"x":432,"y":500,"style":508},[391,520],{"x":436,"y":497,"width":429,"height":444,"rx":394,"fill":504,"stroke":505,"style":452},[412,522,523],{"x":439,"y":500,"style":508},"Revenue",[391,525],{"x":400,"y":526,"width":402,"height":444,"rx":394,"fill":404,"stroke":405,"style":406},"152.0",[412,528,530],{"x":447,"y":529,"style":416},"171.0","5",[391,532],{"x":409,"y":526,"width":410,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[412,534,535],{"x":414,"y":529,"style":473},"North",[391,537],{"x":420,"y":526,"width":421,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[412,539,540],{"x":424,"y":529,"style":473},"Bolts",[391,542],{"x":428,"y":526,"width":429,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[412,544,362],{"x":432,"y":529,"style":473},[391,546],{"x":436,"y":526,"width":429,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[412,548,549],{"x":439,"y":529,"style":473},"54.0",[391,551],{"x":400,"y":552,"width":402,"height":444,"rx":394,"fill":404,"stroke":405,"style":406},"180.0",[412,554,556],{"x":447,"y":555,"style":416},"199.0","6",[391,558],{"x":409,"y":552,"width":410,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[412,560,561],{"x":414,"y":555,"style":473},"South",[391,563],{"x":420,"y":552,"width":421,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[412,565,566],{"x":424,"y":555,"style":473},"Nuts",[391,568],{"x":428,"y":552,"width":429,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[412,570,571],{"x":432,"y":555,"style":473},"80",[391,573],{"x":436,"y":552,"width":429,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[412,575,576],{"x":439,"y":555,"style":473},"9.6",[391,578],{"x":400,"y":579,"width":402,"height":444,"rx":394,"fill":404,"stroke":405,"style":406},"208.0",[412,581,583],{"x":447,"y":582,"style":416},"227.0","7",[391,585],{"x":409,"y":579,"width":410,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[412,587,588],{"x":414,"y":582,"style":473},"…",[391,590],{"x":420,"y":579,"width":421,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[391,592],{"x":428,"y":579,"width":429,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[391,594],{"x":436,"y":579,"width":429,"height":444,"rx":394,"fill":397,"stroke":405,"style":406},[391,596],{"x":400,"y":597,"width":402,"height":444,"rx":394,"fill":404,"stroke":405,"style":406},"236.0",[412,599,601],{"x":447,"y":600,"style":416},"255.0","8",[391,603],{"x":409,"y":597,"width":410,"height":444,"rx":394,"fill":604,"stroke":605,"style":452},"#fdefd8","var(--gold,#b4740a)",[412,607,609],{"x":414,"y":600,"style":608},"font-size:12px;font-weight:700;fill:var(--gold-ink,#7a4e06);text-anchor:middle","Total",[391,611],{"x":420,"y":597,"width":421,"height":444,"rx":394,"fill":604,"stroke":605,"style":452},[391,613],{"x":428,"y":597,"width":429,"height":444,"rx":394,"fill":604,"stroke":605,"style":452},[412,615,616],{"x":432,"y":600,"style":608},"=SUM(…)",[391,618],{"x":436,"y":597,"width":429,"height":444,"rx":394,"fill":604,"stroke":605,"style":452},[412,620,616],{"x":439,"y":600,"style":608},[32,622,624],{"id":623},"step-3-arguments-that-trim-everything-and-formulas-without-results","Step 3 — Arguments that trim everything, and formulas without results",[37,626,628],{"className":86,"code":627,"language":88,"meta":42,"style":42},"args = dict(sheet_name=\"Sales data\", header=3)\ntry:\n    pd.read_excel(\"report.xlsx\", usecols=\"F:H\", **args)\nexcept Exception as e:\n    print(\"usecols='F:H'   \", type(e).__name__, str(e).split(\". (\")[0][:70])\nprint(\"nrows=0         \", pd.read_excel(\"report.xlsx\", nrows=0, **args).shape)\nprint(\"skipfooter=10   \", pd.read_excel(\"report.xlsx\", skipfooter=10, **args).shape)\nprint(\"skipfooter=2    \", pd.read_excel(\"report.xlsx\", skipfooter=2, **args)[\"Region\"].tolist())\ncalc = pd.read_excel(\"report.xlsx\", sheet_name=\"Calc\")\nprint(calc.to_string(index=False))\n",[13,629,630,659,667,692,706,750,780,809,844,867],{"__ignoreMap":42},[46,631,632,635,637,640,643,645,647,649,651,653,655,657],{"class":48,"line":49},[46,633,634],{"class":99},"args ",[46,636,122],{"class":95},[46,638,639],{"class":137}," dict",[46,641,642],{"class":99},"(",[46,644,240],{"class":239},[46,646,122],{"class":95},[46,648,245],{"class":56},[46,650,147],{"class":99},[46,652,316],{"class":239},[46,654,122],{"class":95},[46,656,321],{"class":137},[46,658,131],{"class":99},[46,660,661,664],{"class":48,"line":109},[46,662,663],{"class":95},"try",[46,665,666],{"class":99},":\n",[46,668,669,672,674,676,679,681,684,686,689],{"class":48,"line":116},[46,670,671],{"class":99},"    pd.read_excel(",[46,673,128],{"class":56},[46,675,147],{"class":99},[46,677,678],{"class":239},"usecols",[46,680,122],{"class":95},[46,682,683],{"class":56},"\"F:H\"",[46,685,147],{"class":99},[46,687,688],{"class":95},"**",[46,690,691],{"class":99},"args)\n",[46,693,694,697,700,703],{"class":48,"line":134},[46,695,696],{"class":95},"except",[46,698,699],{"class":137}," Exception",[46,701,702],{"class":95}," as",[46,704,705],{"class":99}," e:\n",[46,707,708,710,712,715,717,720,723,726,728,731,734,737,740,742,745,748],{"class":48,"line":156},[46,709,178],{"class":137},[46,711,642],{"class":99},[46,713,714],{"class":56},"\"usecols='F:H'   \"",[46,716,147],{"class":99},[46,718,719],{"class":137},"type",[46,721,722],{"class":99},"(e).",[46,724,725],{"class":137},"__name__",[46,727,147],{"class":99},[46,729,730],{"class":137},"str",[46,732,733],{"class":99},"(e).split(",[46,735,736],{"class":56},"\". (\"",[46,738,739],{"class":99},")[",[46,741,394],{"class":137},[46,743,744],{"class":99},"][:",[46,746,747],{"class":137},"70",[46,749,265],{"class":99},[46,751,752,754,756,759,762,764,766,769,771,773,775,777],{"class":48,"line":175},[46,753,138],{"class":137},[46,755,642],{"class":99},[46,757,758],{"class":56},"\"nrows=0         \"",[46,760,761],{"class":99},", pd.read_excel(",[46,763,128],{"class":56},[46,765,147],{"class":99},[46,767,768],{"class":239},"nrows",[46,770,122],{"class":95},[46,772,394],{"class":137},[46,774,147],{"class":99},[46,776,688],{"class":95},[46,778,779],{"class":99},"args).shape)\n",[46,781,783,785,787,790,792,794,796,799,801,803,805,807],{"class":48,"line":782},7,[46,784,138],{"class":137},[46,786,642],{"class":99},[46,788,789],{"class":56},"\"skipfooter=10   \"",[46,791,761],{"class":99},[46,793,128],{"class":56},[46,795,147],{"class":99},[46,797,798],{"class":239},"skipfooter",[46,800,122],{"class":95},[46,802,292],{"class":137},[46,804,147],{"class":99},[46,806,688],{"class":95},[46,808,779],{"class":99},[46,810,812,814,816,819,821,823,825,827,829,831,833,835,838,841],{"class":48,"line":811},8,[46,813,138],{"class":137},[46,815,642],{"class":99},[46,817,818],{"class":56},"\"skipfooter=2    \"",[46,820,761],{"class":99},[46,822,128],{"class":56},[46,824,147],{"class":99},[46,826,798],{"class":239},[46,828,122],{"class":95},[46,830,262],{"class":137},[46,832,147],{"class":99},[46,834,688],{"class":95},[46,836,837],{"class":99},"args)[",[46,839,840],{"class":56},"\"Region\"",[46,842,843],{"class":99},"].tolist())\n",[46,845,847,850,852,854,856,858,860,862,865],{"class":48,"line":846},9,[46,848,849],{"class":99},"calc ",[46,851,122],{"class":95},[46,853,125],{"class":99},[46,855,128],{"class":56},[46,857,147],{"class":99},[46,859,240],{"class":239},[46,861,122],{"class":95},[46,863,864],{"class":56},"\"Calc\"",[46,866,131],{"class":99},[46,868,870,872,875,878,880,883],{"class":48,"line":869},10,[46,871,138],{"class":137},[46,873,874],{"class":99},"(calc.to_string(",[46,876,877],{"class":239},"index",[46,879,122],{"class":95},[46,881,882],{"class":137},"False",[46,884,885],{"class":99},"))\n",[10,887,888,890,891,894,895,898,899,901,902,904,905,907,908,911,912,916],{},[13,889,678],{}," pointing at columns beyond the data is not silent in current pandas — it raises a ",[13,892,893],{},"ParserError"," naming the out-of-bounds columns, which at least says where to look; older versions returned an empty frame. ",[13,896,897],{},"nrows=0"," keeps only the header — useful for reading column names, surprising otherwise. A ",[13,900,798],{}," larger than the data removes every row; the right value here is 2, which drops the blank row and the totals row and keeps the four regions. The ",[68,903,78],{}," sheet shows the other signature: the right shape, with the formula column entirely ",[13,906,23],{},". pandas reads the ",[68,909,910],{},"cached results"," of formulas, and a workbook written by openpyxl or XlsxWriter has none until Excel or LibreOffice has opened, calculated and saved it. The data is not missing — it has never been calculated; ",[26,913,915],{"href":914},"\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-formula-cells-reading-as-nan-in-pandas\u002F","Fix Formula Cells Reading as NaN in pandas"," covers recalculating such files.",[372,918,381,924,381,927,381,930,381,934,381,938,381,945,381,951,381,954,381,958,381,962,381,966,381,968,381,973,381,975,381,978,381,981,381,985,381,987,381,991,381,993,381,996,381,998,381,1002,381,1004,381,1008,381,1010,381,1013,381,1016,381,1019,381,1021,381,1025,381,1027],{"viewBox":919,"role":375,"ariaLabelledBy":920,"xmlns":379,"style":923},"4 0 752 208",[921,922],"re-signatures-t","re-signatures-d","width:100%;max-width:752px;height:auto;display:block;margin:1.5rem auto;font-family:Inter,ui-sans-serif,system-ui,sans-serif",[383,925,926],{"id":921},"Signatures of an empty or blank read",[387,928,929],{"id":922},"An empty frame with no columns means the wrong sheet or skiprows past all the data. Columns but no rows means skiprows, skipfooter or nrows removed the data. Wrong column names with Unnamed labels mean the header is on another row. The right shape filled with NaN in formula columns means formulas without cached results.",[391,931],{"x":501,"y":394,"width":932,"height":933,"fill":397},"752","208",[391,935],{"x":936,"y":401,"width":937,"height":443,"rx":394,"fill":397,"stroke":405,"style":406},"20.0","159.5",[391,939],{"x":940,"y":401,"width":941,"height":443,"rx":394,"fill":942,"stroke":943,"style":944},"179.5","280.3","#f0f4ff","var(--brand,#5b5cf0)","stroke-width:1.2px",[412,946,950],{"x":947,"y":948,"style":949},"319.6","41.0","font-size:13px;font-weight:700;fill:var(--brand-strong,#4338ca);text-anchor:middle","what you get",[391,952],{"x":953,"y":401,"width":941,"height":443,"rx":394,"fill":942,"stroke":943,"style":944},"459.7",[412,955,957],{"x":956,"y":948,"style":949},"599.9","likely cause",[391,959],{"x":936,"y":960,"width":937,"height":961,"rx":394,"fill":404,"stroke":405,"style":406},"56.0","34.0",[412,963,213],{"x":402,"y":964,"style":965},"78.0","font-size:12.5px;font-weight:700;fill:var(--text,#172033);text-anchor:start",[391,967],{"x":940,"y":960,"width":941,"height":961,"rx":394,"fill":397,"stroke":405,"style":406},[412,969,972],{"x":947,"y":970,"style":971},"77.0","font-size:11.5px;font-weight:400;fill:var(--text,#172033);text-anchor:middle","no columns",[391,974],{"x":953,"y":960,"width":941,"height":961,"rx":394,"fill":397,"stroke":405,"style":406},[412,976,977],{"x":956,"y":970,"style":971},"wrong sheet, or skiprows past the data",[391,979],{"x":936,"y":980,"width":937,"height":961,"rx":394,"fill":404,"stroke":405,"style":406},"90.0",[412,982,984],{"x":402,"y":983,"style":965},"112.0","(0, n)",[391,986],{"x":940,"y":980,"width":941,"height":961,"rx":394,"fill":397,"stroke":405,"style":406},[412,988,990],{"x":947,"y":989,"style":971},"111.0","columns, no rows",[391,992],{"x":953,"y":980,"width":941,"height":961,"rx":394,"fill":397,"stroke":405,"style":406},[412,994,995],{"x":956,"y":989,"style":971},"skiprows, skipfooter or nrows",[391,997],{"x":936,"y":497,"width":937,"height":961,"rx":394,"fill":404,"stroke":405,"style":406},[412,999,1001],{"x":402,"y":1000,"style":965},"146.0","Unnamed columns",[391,1003],{"x":940,"y":497,"width":941,"height":961,"rx":394,"fill":397,"stroke":405,"style":406},[412,1005,1007],{"x":947,"y":1006,"style":971},"145.0","title read as header",[391,1009],{"x":953,"y":497,"width":941,"height":961,"rx":394,"fill":397,"stroke":405,"style":406},[412,1011,1012],{"x":956,"y":1006,"style":971},"header \u002F skiprows needed",[391,1014],{"x":936,"y":1015,"width":937,"height":961,"rx":394,"fill":404,"stroke":405,"style":406},"158.0",[412,1017,1018],{"x":402,"y":552,"style":965},"NaN formula column",[391,1020],{"x":940,"y":1015,"width":941,"height":961,"rx":394,"fill":397,"stroke":405,"style":406},[412,1022,1024],{"x":947,"y":1023,"style":971},"179.0","right shape",[391,1026],{"x":953,"y":1015,"width":941,"height":961,"rx":394,"fill":397,"stroke":405,"style":406},[412,1028,1029],{"x":956,"y":1023,"style":971},"formulas never calculated",[372,1031,381,1036,381,1039,381,1042,381,1045,381,1052,381,1063,381,1068,381,1072,381,1076,381,1079,381,1084,381,1089,381,1093,381,1098,381,1104,381,1108,381,1112,381,1114,381,1117,381,1121,381,1124,381,1127,381,1134,381,1138,381,1141,381,1143,381,1146,381,1150,381,1153,381,1156,381,1163,381,1167],{"viewBox":1032,"role":375,"ariaLabelledBy":1033,"xmlns":379,"style":923},"4 0 752 272",[1034,1035],"re-route-t","re-route-d",[383,1037,1038],{"id":1034},"From the symptom to the fix",[387,1040,1041],{"id":1035},"If the frame has no columns, list the sheets and check skiprows. If it has columns but no rows, reduce skiprows, skipfooter or nrows. If the columns are Unnamed, set header to the real header row. If formula columns are NaN, recalculate the workbook before reading.",[391,1043],{"x":501,"y":394,"width":932,"height":1044,"fill":397},"272",[391,1046],{"x":1047,"y":401,"width":1048,"height":1049,"rx":1050,"fill":942,"stroke":943,"style":1051},"240.0","280.0","75.5","12","stroke-width:2px",[1053,1054,1056],"g",{"transform":1055},"translate(368.0,29.0) scale(1.000)",[1057,1058],"path",{"d":1059,"fill":1060,"stroke":1061,"style":1062},"M3 5h18v14H3z M3 10h18 M3 15h18 M9 5v14","none","var(--brand-strong,#4338ca)","stroke-width:1.80px;stroke-linecap:round;stroke-linejoin:round",[412,1064,1067],{"x":1065,"y":1049,"style":1066},"380.0","font-size:13.5px;font-weight:700;fill:var(--brand-strong,#4338ca);text-anchor:middle","What did read_excel return?",[48,1069],{"x1":1065,"y1":1070,"x2":1065,"y2":1071,"stroke":943,"style":1051},"91.5","111.5",[48,1073],{"x1":1074,"y1":1071,"x2":1075,"y2":1071,"stroke":943,"style":1051},"134.7","625.3",[48,1077],{"x1":1074,"y1":1071,"x2":1074,"y2":1078,"stroke":943,"style":1051},"157.5",[1080,1081],"polygon",{"points":1082,"fill":1083},"134.7,161.5 129.7,152.5 139.7,152.5","#5b5cf0",[391,1085],{"x":1070,"y":1086,"width":1087,"height":1088,"rx":292,"fill":397,"stroke":405,"style":944},"121.5","86.4","21.0",[412,1090,972],{"x":1074,"y":1091,"style":1092},"136.0","font-size:11.5px;font-weight:700;fill:var(--muted,#5b6780);text-anchor:middle",[391,1094],{"x":936,"y":1095,"width":1096,"height":1097,"rx":1050,"fill":942,"stroke":943,"style":1051},"163.5","229.3","93.0",[1053,1099,1101],{"transform":1100},"translate(122.7,176.5) scale(1.000)",[1057,1102],{"d":1103,"fill":1060,"stroke":1061,"style":1062},"M11 4a7 7 0 1 0 .01 0z M16 16l5 5",[412,1105,1107],{"x":1074,"y":1106,"style":1066},"223.0","check sheet_name, skiprows",[412,1109,1111],{"x":1074,"y":1110,"style":971},"242.5","list the sheets",[48,1113],{"x1":1065,"y1":1071,"x2":1065,"y2":1078,"stroke":943,"style":1051},[1080,1115],{"points":1116,"fill":1083},"380.0,161.5 375.0,152.5 385.0,152.5",[391,1118],{"x":1119,"y":1086,"width":1120,"height":1088,"rx":292,"fill":397,"stroke":405,"style":944},"313.9","132.3",[412,1122,1123],{"x":1065,"y":1091,"style":1092},"no rows \u002F Unnamed",[391,1125],{"x":1126,"y":1095,"width":1096,"height":1097,"rx":1050,"fill":504,"stroke":505,"style":1051},"265.3",[1053,1128,1130],{"transform":1129},"translate(368.0,176.5) scale(1.000)",[1057,1131],{"d":1132,"fill":1060,"stroke":1133,"style":1062},"M3 5h18l-7 8v6l-4 2v-8z","var(--teal-ink,#0b6157)",[412,1135,1137],{"x":1065,"y":1106,"style":1136},"font-size:13.5px;font-weight:700;fill:var(--teal-ink,#0b6157);text-anchor:middle","fix header, skipfooter, nrows",[412,1139,1140],{"x":1065,"y":1110,"style":971},"find the header row",[48,1142],{"x1":1075,"y1":1071,"x2":1075,"y2":1078,"stroke":943,"style":1051},[1080,1144],{"points":1145,"fill":1083},"625.3,161.5 620.3,152.5 630.3,152.5",[391,1147],{"x":1148,"y":1086,"width":1149,"height":1088,"rx":292,"fill":397,"stroke":405,"style":944},"575.8","99.0",[412,1151,1152],{"x":1075,"y":1091,"style":1092},"NaN formulas",[391,1154],{"x":1155,"y":1095,"width":1096,"height":1097,"rx":1050,"fill":604,"stroke":605,"style":1051},"510.7",[1053,1157,1159],{"transform":1158},"translate(613.3,176.5) scale(1.000)",[1057,1160],{"d":1161,"fill":1060,"stroke":1162,"style":1062},"M20 11a8 8 0 1 0-2.3 5.7 M20 4v7h-7","var(--gold-ink,#7a4e06)",[412,1164,1166],{"x":1075,"y":1106,"style":1165},"font-size:13.5px;font-weight:700;fill:var(--gold-ink,#7a4e06);text-anchor:middle","recalculate first",[412,1168,1169],{"x":1075,"y":1110,"style":971},"no cached results",[32,1171,1173],{"id":1172},"step-4-a-diagnostic-that-finds-the-data","Step 4 — A diagnostic that finds the data",[10,1175,1176],{},"When a file arrives and a read comes back empty, inspect the workbook rather than guessing arguments:",[37,1178,1180],{"className":86,"code":1179,"language":88,"meta":42,"style":42},"from openpyxl import load_workbook\n\ndef where_is_the_data(path, min_filled=2):\n    wb = load_workbook(path, read_only=True)\n    report = []\n    for ws in wb.worksheets:\n        rows = list(ws.iter_rows(values_only=True))\n        filled = [sum(v is not None for v in r) for r in rows]\n        header = next((i for i, n in enumerate(filled) if n >= min_filled), None)\n        data_rows = sum(1 for n in filled[header + 1:] if n >= min_filled) if header is not None else 0\n        report.append({\"sheet\": ws.title, \"state\": ws.sheet_state, \"used rows\": len(rows),\n                       \"header (0-based)\": \"\" if header is None else header, \"data rows\": data_rows,\n                       \"suggest\": f'sheet_name=\"{ws.title}\", header={header}' if header is not None else \"no table found\"})\n    wb.close()\n    return pd.DataFrame(report)\n\nprint(where_is_the_data(\"report.xlsx\").to_string(index=False))\n",[13,1181,1182,1195,1199,1218,1238,1248,1262,1284,1331,1374,1432,1462,1493,1547,1553,1562,1567],{"__ignoreMap":42},[46,1183,1184,1187,1190,1192],{"class":48,"line":49},[46,1185,1186],{"class":95},"from",[46,1188,1189],{"class":99}," openpyxl ",[46,1191,96],{"class":95},[46,1193,1194],{"class":99}," load_workbook\n",[46,1196,1197],{"class":48,"line":109},[46,1198,113],{"emptyLinePlaceholder":112},[46,1200,1201,1204,1208,1211,1213,1215],{"class":48,"line":116},[46,1202,1203],{"class":95},"def",[46,1205,1207],{"class":1206},"s_Opv"," where_is_the_data",[46,1209,1210],{"class":99},"(path, min_filled",[46,1212,122],{"class":95},[46,1214,262],{"class":137},[46,1216,1217],{"class":99},"):\n",[46,1219,1220,1223,1225,1228,1231,1233,1236],{"class":48,"line":134},[46,1221,1222],{"class":99},"    wb ",[46,1224,122],{"class":95},[46,1226,1227],{"class":99}," load_workbook(path, ",[46,1229,1230],{"class":239},"read_only",[46,1232,122],{"class":95},[46,1234,1235],{"class":137},"True",[46,1237,131],{"class":99},[46,1239,1240,1243,1245],{"class":48,"line":156},[46,1241,1242],{"class":99},"    report ",[46,1244,122],{"class":95},[46,1246,1247],{"class":99}," []\n",[46,1249,1250,1253,1256,1259],{"class":48,"line":175},[46,1251,1252],{"class":95},"    for",[46,1254,1255],{"class":99}," ws ",[46,1257,1258],{"class":95},"in",[46,1260,1261],{"class":99}," wb.worksheets:\n",[46,1263,1264,1267,1269,1272,1275,1278,1280,1282],{"class":48,"line":782},[46,1265,1266],{"class":99},"        rows ",[46,1268,122],{"class":95},[46,1270,1271],{"class":137}," list",[46,1273,1274],{"class":99},"(ws.iter_rows(",[46,1276,1277],{"class":239},"values_only",[46,1279,122],{"class":95},[46,1281,1235],{"class":137},[46,1283,885],{"class":99},[46,1285,1286,1289,1291,1294,1297,1300,1303,1306,1309,1312,1315,1317,1320,1323,1326,1328],{"class":48,"line":811},[46,1287,1288],{"class":99},"        filled ",[46,1290,122],{"class":95},[46,1292,1293],{"class":99}," [",[46,1295,1296],{"class":137},"sum",[46,1298,1299],{"class":99},"(v ",[46,1301,1302],{"class":95},"is",[46,1304,1305],{"class":95}," not",[46,1307,1308],{"class":137}," None",[46,1310,1311],{"class":95}," for",[46,1313,1314],{"class":99}," v ",[46,1316,1258],{"class":95},[46,1318,1319],{"class":99}," r) ",[46,1321,1322],{"class":95},"for",[46,1324,1325],{"class":99}," r ",[46,1327,1258],{"class":95},[46,1329,1330],{"class":99}," rows]\n",[46,1332,1333,1336,1338,1341,1344,1346,1349,1351,1354,1357,1360,1363,1366,1369,1372],{"class":48,"line":846},[46,1334,1335],{"class":99},"        header ",[46,1337,122],{"class":95},[46,1339,1340],{"class":137}," next",[46,1342,1343],{"class":99},"((i ",[46,1345,1322],{"class":95},[46,1347,1348],{"class":99}," i, n ",[46,1350,1258],{"class":95},[46,1352,1353],{"class":137}," enumerate",[46,1355,1356],{"class":99},"(filled) ",[46,1358,1359],{"class":95},"if",[46,1361,1362],{"class":99}," n ",[46,1364,1365],{"class":95},">=",[46,1367,1368],{"class":99}," min_filled), ",[46,1370,1371],{"class":137},"None",[46,1373,131],{"class":99},[46,1375,1376,1379,1381,1384,1386,1388,1390,1392,1394,1397,1400,1403,1406,1408,1410,1412,1415,1417,1420,1422,1424,1426,1429],{"class":48,"line":869},[46,1377,1378],{"class":99},"        data_rows ",[46,1380,122],{"class":95},[46,1382,1383],{"class":137}," sum",[46,1385,642],{"class":99},[46,1387,449],{"class":137},[46,1389,1311],{"class":95},[46,1391,1362],{"class":99},[46,1393,1258],{"class":95},[46,1395,1396],{"class":99}," filled[header ",[46,1398,1399],{"class":95},"+",[46,1401,1402],{"class":137}," 1",[46,1404,1405],{"class":99},":] ",[46,1407,1359],{"class":95},[46,1409,1362],{"class":99},[46,1411,1365],{"class":95},[46,1413,1414],{"class":99}," min_filled) ",[46,1416,1359],{"class":95},[46,1418,1419],{"class":99}," header ",[46,1421,1302],{"class":95},[46,1423,1305],{"class":95},[46,1425,1308],{"class":137},[46,1427,1428],{"class":95}," else",[46,1430,1431],{"class":137}," 0\n",[46,1433,1435,1438,1441,1444,1447,1450,1453,1456,1459],{"class":48,"line":1434},11,[46,1436,1437],{"class":99},"        report.append({",[46,1439,1440],{"class":56},"\"sheet\"",[46,1442,1443],{"class":99},": ws.title, ",[46,1445,1446],{"class":56},"\"state\"",[46,1448,1449],{"class":99},": ws.sheet_state, ",[46,1451,1452],{"class":56},"\"used rows\"",[46,1454,1455],{"class":99},": ",[46,1457,1458],{"class":137},"len",[46,1460,1461],{"class":99},"(rows),\n",[46,1463,1465,1468,1470,1473,1476,1478,1480,1482,1484,1487,1490],{"class":48,"line":1464},12,[46,1466,1467],{"class":56},"                       \"header (0-based)\"",[46,1469,1455],{"class":99},[46,1471,1472],{"class":56},"\"\"",[46,1474,1475],{"class":95}," if",[46,1477,1419],{"class":99},[46,1479,1302],{"class":95},[46,1481,1308],{"class":137},[46,1483,1428],{"class":95},[46,1485,1486],{"class":99}," header, ",[46,1488,1489],{"class":56},"\"data rows\"",[46,1491,1492],{"class":99},": data_rows,\n",[46,1494,1496,1499,1501,1504,1507,1511,1514,1517,1520,1522,1524,1526,1529,1531,1533,1535,1537,1539,1541,1544],{"class":48,"line":1495},13,[46,1497,1498],{"class":56},"                       \"suggest\"",[46,1500,1455],{"class":99},[46,1502,1503],{"class":95},"f",[46,1505,1506],{"class":56},"'sheet_name=\"",[46,1508,1510],{"class":1509},"sSjpA","{",[46,1512,1513],{"class":99},"ws.title",[46,1515,1516],{"class":1509},"}",[46,1518,1519],{"class":56},"\", header=",[46,1521,1510],{"class":1509},[46,1523,316],{"class":99},[46,1525,1516],{"class":1509},[46,1527,1528],{"class":56},"'",[46,1530,1475],{"class":95},[46,1532,1419],{"class":99},[46,1534,1302],{"class":95},[46,1536,1305],{"class":95},[46,1538,1308],{"class":137},[46,1540,1428],{"class":95},[46,1542,1543],{"class":56}," \"no table found\"",[46,1545,1546],{"class":99},"})\n",[46,1548,1550],{"class":48,"line":1549},14,[46,1551,1552],{"class":99},"    wb.close()\n",[46,1554,1556,1559],{"class":48,"line":1555},15,[46,1557,1558],{"class":95},"    return",[46,1560,1561],{"class":99}," pd.DataFrame(report)\n",[46,1563,1565],{"class":48,"line":1564},16,[46,1566,113],{"emptyLinePlaceholder":112},[46,1568,1570,1572,1575,1577,1580,1582,1584,1586],{"class":48,"line":1569},17,[46,1571,138],{"class":137},[46,1573,1574],{"class":99},"(where_is_the_data(",[46,1576,128],{"class":56},[46,1578,1579],{"class":99},").to_string(",[46,1581,877],{"class":239},[46,1583,122],{"class":95},[46,1585,882],{"class":137},[46,1587,885],{"class":99},[10,1589,1590,1591,1593,1594,1596,1597,1599,1600,1602,1603,1606,1607,1610],{},"For every sheet, the diagnostic reports how many rows are used, the first row with at least two filled cells — the likely header — and how many data rows follow, and suggests the matching ",[13,1592,186],{}," arguments. The ",[68,1595,70],{}," sheet has no table; ",[68,1598,74],{}," has its header at index 3 with five filled rows below it (the four regions and the totals row); ",[68,1601,78],{}," has its header at row 0. Raise ",[13,1604,1605],{},"min_filled"," for wide tables whose title rows also span a couple of cells. Running this on an unfamiliar file takes a second and replaces trial and error with a direct answer. It reads with openpyxl's ",[13,1608,1609],{},"read_only=True",", so it stays fast on large workbooks, and it reports hidden sheets, which are another place data turns up unexpectedly.",[32,1612,1614],{"id":1613},"check-you-read-the-file-you-think-you-read","Check you read the file you think you read",[10,1616,1617,1618,1621,1622,1625,1626,1629],{},"One more cause produces exactly the same symptoms and has nothing to do with arguments: reading a different file from the one you opened in Excel. A relative path resolves against the script's ",[68,1619,1620],{},"working directory",", which differs between an IDE, a terminal and a scheduler, so ",[13,1623,1624],{},"report.xlsx"," can mean an older copy elsewhere. Cloud-synced folders can hold a placeholder until the file is downloaded, and a file being written by another process may be read half-finished. Print ",[13,1627,1628],{},"Path(path).resolve()",", the file's size and its modification time before reading when something looks wrong; if they do not match what you expect, the arguments were never the problem. Scripts that run unattended should use absolute paths built from a configuration value rather than relying on the current directory.",[32,1631,1633],{"id":1632},"common-pitfalls","Common pitfalls",[1635,1636,1637,1648,1656,1664,1672],"ul",{},[1638,1639,1640,1644,1645,1647],"li",{},[1641,1642,1643],"strong",{},"Relying on the first sheet."," Pass ",[13,1646,240],{}," by name.",[1638,1649,1650,1655],{},[1641,1651,1652,1653,30],{},"Guessing ",[13,1654,287],{}," Find the header row; overshooting empties the frame.",[1638,1657,1658,1663],{},[1641,1659,1660,1662],{},[13,1661,798],{}," larger than the footer."," It removes data rows too.",[1638,1665,1666,1671],{},[1641,1667,1668,1670],{},[13,1669,678],{}," on the wrong letters."," Check where the table really is; out-of-range columns raise an error.",[1638,1673,1674,1677],{},[1641,1675,1676],{},"NaN in formula columns."," The workbook was never calculated; recalculate it first.",[32,1679,1681],{"id":1680},"conclusion","Conclusion",[10,1683,1684,1685,1687,1688,1690,1691,1693,1694,147,1696,1690,1698,1700,1701,1703,1704,1706,1707,1709,1710,1712],{},"An empty result from ",[13,1686,186],{}," almost always means the arguments point away from the data: the default first sheet is empty, ",[13,1689,287],{}," or ",[13,1692,316],{}," miss the header row, ",[13,1695,678],{},[13,1697,768],{},[13,1699,798],{}," trim everything, or formula cells have never been calculated. Recognise the signature — no columns, no rows, ",[68,1702,335],{}," columns or ",[13,1705,23],{}," formulas — list the sheets, find the header row, and pass ",[13,1708,240],{}," and ",[13,1711,316],{}," explicitly; a small openpyxl diagnostic finds them for any workbook.",[32,1714,1716],{"id":1715},"frequently-asked-questions","Frequently asked questions",[10,1718,1719,1722],{},[1641,1720,1721],{},"Why does pandas read_excel return an empty DataFrame?","\nUsually because it read the first sheet, which is empty, or because skiprows, header, usecols, nrows or skipfooter point away from the data. List the sheets and pass sheet_name and header explicitly.",[10,1724,1725,1728],{},[1641,1726,1727],{},"How do I see which sheets an Excel file has in pandas?","\nUse pd.ExcelFile(path).sheet_names, then read the one you need with sheet_name.",[10,1730,1731,1734],{},[1641,1732,1733],{},"Why are my formula columns NaN when reading with pandas?","\npandas reads saved formula results, and files written by Python libraries have none until opened and saved in Excel or recalculated with LibreOffice.",[10,1736,1737,1740],{},[1641,1738,1739],{},"How do I find the header row automatically?","\nScan the sheet with openpyxl for the first row with several filled cells and pass its zero-based index to read_excel as header.",[32,1742,1744],{"id":1743},"related","Related",[1635,1746,1747,1753,1760,1767],{},[1638,1748,1749,1750,1752],{},"Up one level: ",[26,1751,29],{"href":28}," — fixes for common errors.",[1638,1754,1755,1759],{},[26,1756,1758],{"href":1757},"\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-unnamed-0-columns-when-reading-excel\u002F","Fix Unnamed: 0 Columns When Reading Excel"," — the header's other symptom.",[1638,1761,1762,1766],{},[26,1763,1765],{"href":1764},"\u002Fgetting-started-with-python-excel-automation\u002Fworking-with-multiple-excel-sheets-in-python\u002Fread-all-sheets-from-an-excel-file-into-dataframes\u002F","Read All Sheets from an Excel File into DataFrames"," — reading every sheet.",[1638,1768,1769,1773],{},[26,1770,1772],{"href":1771},"\u002Fadvanced-data-transformation-and-cleaning\u002Fextracting-data-from-messy-excel-sheets\u002Fstop-reading-at-notes-and-footers-below-the-data\u002F","Stop Reading at Notes and Footers Below the Data"," — trimming the bottom.",[1775,1776,1777],"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 .sP0c6, html code.shiki .sP0c6{--shiki-default:#005CC5;--shiki-dark:#91CBFF}html pre.shiki code .sa561, html code.shiki .sa561{--shiki-default:#E36209;--shiki-dark:#FFB757}html pre.shiki code .s_Opv, html code.shiki .s_Opv{--shiki-default:#6F42C1;--shiki-dark:#DBB7FF}html pre.shiki code .sSjpA, html code.shiki .sSjpA{--shiki-default:#005CC5;--shiki-dark:#FF9492}",{"title":42,"searchDepth":109,"depth":109,"links":1779},[1780,1781,1782,1783,1784,1785,1786,1787,1788,1789],{"id":34,"depth":109,"text":35},{"id":82,"depth":109,"text":83},{"id":217,"depth":109,"text":218},{"id":623,"depth":109,"text":624},{"id":1172,"depth":109,"text":1173},{"id":1613,"depth":109,"text":1614},{"id":1632,"depth":109,"text":1633},{"id":1680,"depth":109,"text":1681},{"id":1715,"depth":109,"text":1716},{"id":1743,"depth":109,"text":1744},"2026-10-02","Find out why pandas read_excel returns an empty DataFrame — or one full of NaN — for a file that clearly has data: the wrong sheet read by default, skiprows or header set past the data, usecols pointing at empty columns, skipfooter or nrows trimming everything, and formulas with no saved results; with a diagnostic that inspects the workbook and suggests the right arguments.","md",[1794,1796,1798,1800],{"q":1721,"a":1795},"Usually because it read the first sheet, which is empty, or because skiprows, header, usecols, nrows or skipfooter point away from the data. List the sheets and pass sheet_name and header explicitly.",{"q":1727,"a":1797},"Use pd.ExcelFile(path).sheet_names, then read the one you need with sheet_name.",{"q":1733,"a":1799},"pandas reads saved formula results, and files written by Python libraries have none until opened and saved in Excel or recalculated with LibreOffice.",{"q":1739,"a":1801},"Scan the sheet with openpyxl for the first row with several filled cells and pass its zero-based index to read_excel as header.","read_excel returns empty dataframe",null,{"breadcrumb":1805},[1806,1809,1812],{"name":1807,"item":1808},"Home","\u002F",{"name":1810,"item":1811},"Getting Started with Python Excel Automation","\u002Fgetting-started-with-python-excel-automation\u002F",{"name":29,"item":28},"\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-read-excel-returning-an-empty-dataframe",{"title":1815,"description":1816},"Fix pandas read_excel Returning an Empty DataFrame","Why read_excel returns no rows or all NaN: default first sheet, skiprows and header past the data, usecols on empty columns, skipfooter and nrows, uncached formulas — plus a workbook diagnostic that finds the data.","fix-read-excel-returning-an-empty-dataframe","getting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-read-excel-returning-an-empty-dataframe\u002Findex",[1820,1821],"troubleshooting","reading-excel","how-to","LVkojAzNpSv_9sRx5m6gi2BmFfwAiAQ2lPSZmRsKBE4",[1825,1829],{"title":1826,"path":1827,"stem":1828,"children":-1},"Fix pandas FutureWarnings in Excel Pipelines","\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-pandas-futurewarnings-in-excel-pipelines","getting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-pandas-futurewarnings-in-excel-pipelines\u002Findex",{"title":1830,"path":1831,"stem":1832,"children":-1},"Fix ReadOnlyWorksheet Has No Attribute Errors in openpyxl","\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-readonlyworksheet-has-no-attribute-errors-in-openpyxl","getting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-readonlyworksheet-has-no-attribute-errors-in-openpyxl\u002Findex",[1834,1836],{"path":1835,"title":1810},"\u002Fgetting-started-with-python-excel-automation",{"path":1837,"title":29},"\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors",[],[1840,1844,1847,1850,1853,1856],{"path":1841,"title":1842,"kind":1843},"\u002Fautomating-reporting-workflows\u002Ferror-handling-and-logging-in-excel-automation\u002Fhandle-permission-denied-when-writing-excel-in-python","Handle Permission Denied When Writing Excel in Python","fix",{"path":1845,"title":1846,"kind":1822},"\u002Fgetting-started-with-python-excel-automation\u002Fusing-openpyxl-for-excel-file-manipulation\u002Fwhat-openpyxl-loses-when-saving-an-existing-workbook","What openpyxl Loses When You Save an Existing Workbook",{"path":1848,"title":1849,"kind":1843},"\u002Fadvanced-data-transformation-and-cleaning\u002Fworking-with-dates-and-times-in-excel-data\u002Ffix-excel-serial-numbers-showing-instead-of-dates","Fix Excel Serial Numbers Showing Instead of Dates",{"path":1851,"title":1852,"kind":1822},"\u002Fadvanced-data-transformation-and-cleaning\u002Fworking-with-dates-and-times-in-excel-data\u002Fhandle-daylight-saving-time-in-excel-timestamps","Handle Daylight Saving Time in Excel Timestamps",{"path":1854,"title":1855,"kind":1822},"\u002Fautomating-reporting-workflows\u002Fautomating-excel-online-with-microsoft-graph\u002Fhandle-microsoft-graph-throttling-for-excel","Handle Microsoft Graph Throttling in Excel Automation",{"path":1857,"title":1858,"kind":1859},"\u002Fautomating-reporting-workflows\u002Ferror-handling-and-logging-in-excel-automation","Error Handling and Logging in Excel Automation","guide",1790972067407]