{
    "componentChunkName": "component---src-templates-blog-post-js",
    "path": "/reading-excel-files-using-pandas/",
    "result": {"data":{"markdownRemark":{"html":"<div class=\"table-of-contents\">\n<ul>\n<li><a href=\"#reading-an-excel-file-with-a-single-worksheet\">Reading an Excel file with a single worksheet</a></li>\n<li><a href=\"#reading-an-excel-file-with-multiple-worksheets\">Reading an Excel file with multiple worksheets</a></li>\n</ul>\n</div>\n<h3 id=\"reading-an-excel-file-with-a-single-worksheet\" style=\"position:relative;\"><a href=\"#reading-an-excel-file-with-a-single-worksheet\" aria-label=\"reading an excel file with a single worksheet permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Reading an Excel file with a single worksheet</h3>\n<p>Let’s say we have an Excel file named <del>sales.xlsx</del> and the file contains a single worksheet named <del>Data</del>.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 604px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/13bb52dda9cc5231f7e566b4179e55a6/1994c/sales.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 68%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAIAAACgpqunAAAACXBIWXMAAA7DAAAOwwHHb6hkAAACbUlEQVQoz42Sy27TQBiF/TDQii2ULngCWmAH7YIHYF8J2hWlrHkCVEHVDSwQEpdNoeklzcXxLY7j2InjNEmbOrbHnvHMOAmo8RglrapuQBz9+nR0pKN/c7h7r5/Orj68tfZobn1p/tXy7ZePF948u7O+dOP5wuzag5nVxZnVS958sTi3/mR+Y/nuxvLMyv3ZlQVOMtWCJvC6xOuSaJRzKp9XeaEmFzQhWy7yupSvlCanCcWqWKrJWaWQU/mLnCOIxCQOAfT6PokoRhgGEIWIYkoiEuN4QOMRHQxpPIoHE0PoENNRPEk4jIKYoAgC4DoEhQOCCApQ4A8pjjGMMUIIgiAIwxAAMOXEX4j7kLXe7ujb+9b2fmPzh/Eu09jKmFsZ8/1eYytT3/xpNE+9CIUQQhAAhBAAAEKIpuI+Z4SjmvMlq33P6x93+G8F87B6siu3csbZp13ha04P8SBN0yRJ0jRljF0xTVNOVMpnXqCbltGwBblsNts91291e44fyqqm121C4yRJzs/PkyQZT3XhkyThjkpS6wxIWl3RG1leLht2q+cbrdO2ExSkilStYxqza+UrXpbbTqDoDbVm5QWlUj+2uk6t2e04Aa9oomb+q3yQF6xOX6zU5Gr9MC8oumXYXa1x3Dp1s0UxJ6qYUMb+Ut7PlawTl1f0UlnPHPFi1arZXdW0j3v+3hF/UJQnn/9WdvwQkpEfYoQHLkAAUUSGYRSHeOBD7AbR6Ndvxth4PGaMJUlyRcYYFyFIcBRh5JGAUgI8D8IQRxFCEEcRwRGc7iGY7uQ6JyPpdNp2s9n3+vUT2/Vc13E81wW+/z/3B44ezvvPl/PUAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Sales\"\n        title=\"Sales\"\n        src=\"/static/13bb52dda9cc5231f7e566b4179e55a6/1994c/sales.png\"\n        srcset=\"/static/13bb52dda9cc5231f7e566b4179e55a6/56d15/sales.png 200w,\n/static/13bb52dda9cc5231f7e566b4179e55a6/d9f49/sales.png 400w,\n/static/13bb52dda9cc5231f7e566b4179e55a6/1994c/sales.png 604w\"\n        sizes=\"(max-width: 604px) 100vw, 604px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n        decoding=\"async\"\n      />\n  </a>\n    </span></p>\n<p>We can read the data inside the file into a <del>DataFrame</del> using the <del>read_excel()</del> method as shown below:</p>\n<pre class=\"grvsc-container synthwave-84\" data-language=\"py\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"grvsc-gutter-pad\"></span><span class=\"grvsc-gutter grvsc-line-number\" aria-hidden=\"true\" data-content=\"1\"></span><span class=\"grvsc-source\"><span class=\"mtk10\">import</span><span class=\"mtk15\"> pandas </span><span class=\"mtk10\">as</span><span class=\"mtk15\"> pd</span></span></span></code></pre>\n<pre class=\"grvsc-container synthwave-84\" data-language=\"py\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"grvsc-gutter-pad\"></span><span class=\"grvsc-gutter grvsc-line-number\" aria-hidden=\"true\" data-content=\"1\"></span><span class=\"grvsc-source\"><span class=\"mtk15\">df </span><span class=\"mtk12\">=</span><span class=\"mtk15\"> pd.</span><span class=\"mtk6\">read_excel</span><span class=\"mtk15\">(</span><span class=\"mtk16\">&quot;sales.xlsx&quot;</span><span class=\"mtk15\">)</span></span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-gutter-pad\"></span><span class=\"grvsc-gutter grvsc-line-number\" aria-hidden=\"true\" data-content=\"2\"></span><span class=\"grvsc-source\"><span class=\"mtk15\">df.</span><span class=\"mtk6\">head</span><span class=\"mtk15\">()</span></span></span></code></pre>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 471px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/d6603b48171603d7bbbacab55a2a0509/27c0d/Sales_Output.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 37.99999999999999%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAIAAAB2/0i6AAAACXBIWXMAAA7DAAAOwwHHb6hkAAABS0lEQVQY01WQXVPrIBRF+/9/m86oN0nVas1HQyBAIKEnBDiAk3ZGvftpPZy158w+ONYHNeUUU0re+4CIEYP3uBPGGIP3IQTv3c43QsR8yyFFzCkiIqO0KIqyqt7eTy/Pz69v76fTx+f5XBX/qur48vRU13VZFg+Pj0VZ3v3DvQMAGGPOu67tKGWSi8ulb5q6J4O1dl2tVopzoSZ5PFZdd4nxj4yIzrmcMx9HIQRcQQjJ+aj1fD/YrF0B1hW6puVCxBh/ZWutlDKE0DZN3xPJRdt1bdsOlDrntm1TSkkplZqqY9kTklL6lb33AJBzppRNcrouRgg5juOkVLwFAJbFrABNU3Mh0n2wH9kYk3Pu+54xtuh5oIwQwrmMcZ8TAOZ5uV7N1/lzGOh/bzu3aa2995RSzrlWmrI9Qspt26y1xhitZmMWMhDGRsRd/gb398QevSETpgAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Sales\"\n        title=\"Sales\"\n        src=\"/static/d6603b48171603d7bbbacab55a2a0509/27c0d/Sales_Output.png\"\n        srcset=\"/static/d6603b48171603d7bbbacab55a2a0509/56d15/Sales_Output.png 200w,\n/static/d6603b48171603d7bbbacab55a2a0509/d9f49/Sales_Output.png 400w,\n/static/d6603b48171603d7bbbacab55a2a0509/27c0d/Sales_Output.png 471w\"\n        sizes=\"(max-width: 471px) 100vw, 471px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n        decoding=\"async\"\n      />\n  </a>\n    </span></p>\n<h3 id=\"reading-an-excel-file-with-multiple-worksheets\" style=\"position:relative;\"><a href=\"#reading-an-excel-file-with-multiple-worksheets\" aria-label=\"reading an excel file with multiple worksheets permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Reading an Excel file with multiple worksheets</h3>\n<p>Let’s say we have an Excel file named <del>budget.xlsx</del> and the file contains 2 worksheets: <del>ZoneWise</del> &#x26; <del>LineWise</del>.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 400px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/787da696dfd9616363e55035a38878a8/d9f49/budget.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 101%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAACXBIWXMAAA7DAAAOwwHHb6hkAAADgUlEQVQ4y52S32scVRTH529QFBEfFH0q+CSIRFQUFEXoiw8FffNRVEq1D0WttUmJoG3TJk3FaBHUmmoTY2Pb7U/ipk02adLtbLLzI9kZdzJz5/6au/N7f8zM7sjuxDX66IfDmXPuOd+591wu98jel54+tOeh91948L3nev75XQd2P/7hq0/sf+3RfS8PHH5rYPDN+9999r53Bh7e++JTB97Yte/1xz545cn9ux94+xlucOrUlxe+PTx96uPJ44fOj35ybmT416+GpsaHpse7pd++OTp75qPJ4wd/PnHw3InPZ74+MjX+2dTY4C9jn/40woW2yxBu+SHUdJdYFoA2psQwsQ5cytCWXsMUabrT81nJwdSsai61OAAMCCGhxLIsTPCWvmUAgxCMu0YIJcAECCNKqWVZhBJKaddbXc8hCAkhURw3mk3fD4BpYkx83280GkFY94OAUup5fqsV1evNRrNLq9XqfZucrusEmXpVJdBgBAJNxabOCIJAh4bGCLQIQkDXVIViSBHQdb1Sqeg9OEmWz87J4zlpeIofu7g+8nv5yPTaydnS2fzm0Vnhi+nixFVp4po0kVs/c1MZu7ROLcYYcxzHtm2uUql8d+XuyMzqaE4+Nr18bKZ4MrdxOrd++sKdocnF0Ytr3+eVH25Vzy/pE5f54R/nWlGcpmmn02m325wsSyWeXy0WrVpNFNb5UsliNYhxRVEWFxbKosRsx3Y91w8EUfgjn4+iqNPpJEkSxzG3sSHNF1YLvKSYbGGFzy/zsoYFFcgavDp3+9r8kmIyFTKNuEu8cOl6vvVv8Ub+dqFQLBvELqwU55fvKjrZ1MyNqpG7Pnfz1tIWYjqumZa7wpdnL99otqK0L5YkCRg6IaQeBhRDhFAY+L7neq4DDMM0zXoYNOphs1GvMUtVq1EU79hZluv1Rpqm7R79y+h0OlncJ+2Rtf1z7CAIs59FUZQkSbvdjuM46dFfyein22JRFIIwTNM0y7OmTLwz+M/6tlgQhCAI/qd48c4ScVg2Xr8vO3M2YX/anen2I7lX4gEywzD0PM/3/aSdxEncaDWSpB0EgW3bjuNkJc/zHMfx/8bzPA5jjCAEAJimCQC4VxVvlAtX+Pm1rU1Nq66VSjzPq4piGIaqqqIowl5zBidLYvVPRVU2RaHsuQ4iEBFELIwpYsyqMVarMbtn3Zhtx5n9BUBTCd/vZvUvAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Budget\"\n        title=\"Budget\"\n        src=\"/static/787da696dfd9616363e55035a38878a8/d9f49/budget.png\"\n        srcset=\"/static/787da696dfd9616363e55035a38878a8/56d15/budget.png 200w,\n/static/787da696dfd9616363e55035a38878a8/d9f49/budget.png 400w\"\n        sizes=\"(max-width: 400px) 100vw, 400px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n        decoding=\"async\"\n      />\n  </a>\n    </span></p>\n<p>If we read the data inside the file, pandas, by default, will read the first sheet: <del>ZoneWise</del>.</p>\n<p>But what if we want to read the <del>LineWise</del> sheet?</p>\n<p>We can do so by passing the name of the second sheet to the <del>sheet_name</del> parameter, as shown below:</p>\n<pre class=\"grvsc-container synthwave-84\" data-language=\"py\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"grvsc-gutter-pad\"></span><span class=\"grvsc-gutter grvsc-line-number\" aria-hidden=\"true\" data-content=\"1\"></span><span class=\"grvsc-source\"><span class=\"mtk15\">df </span><span class=\"mtk12\">=</span><span class=\"mtk15\"> pd.</span><span class=\"mtk6\">read_excel</span><span class=\"mtk15\">(</span><span class=\"mtk16\">&quot;sales.xlsx&quot;</span><span class=\"mtk15\">, </span><span class=\"mtk8 mtki\">sheet_name</span><span class=\"mtk12\">=</span><span class=\"mtk16\">&quot;LineWise&quot;</span><span class=\"mtk15\">)</span></span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-gutter-pad\"></span><span class=\"grvsc-gutter grvsc-line-number\" aria-hidden=\"true\" data-content=\"2\"></span><span class=\"grvsc-source\"><span class=\"mtk15\">df.</span><span class=\"mtk6\">head</span><span class=\"mtk15\">()</span></span></span></code></pre>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 386px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/92b52b6c01c2df0393d1f00febe95854/d999c/Budget-Linewise.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 39.49999999999999%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAIAAAB2/0i6AAAACXBIWXMAAA7DAAAOwwHHb6hkAAABMklEQVQY012P626DMAxG+/5vtk3bNFBbtVCahFtIMAkh3JIQtg5pq/h+WJato2MfbCsMp1NG3DCsT/Heb9U5tzhnjNkmy2+2/uAX563x1qzL4pybpskaa62No6iGRnWKcZYR8v7xCVCHYfAVBC+vbwihB/zsKcuSM04IOh6Pp9MJE5zcbghhlNyDMOScM8YA4Hw+X67XPdypTqmO0hJjhDEWQvKKATTA+S1J5nl21i7LkmekKIp/eMs8z1LKNE2LoiAkVUpBXUvZiqZBGP29WtGS0mpvBoCu67TWcXyNoqhiLM+yklKaF5fLRWvd9/04jgQjTMge1lqP48hYlRKM0F0IwaoKoKkrFsWRMcY5571PCcqyfH/2tm5b2QAIAcM4PmzDMOi+rutNsK6rlEK26gf+BvthxFAWzx8ZAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Budget-Linewise\"\n        title=\"Budget-Linewise\"\n        src=\"/static/92b52b6c01c2df0393d1f00febe95854/d999c/Budget-Linewise.png\"\n        srcset=\"/static/92b52b6c01c2df0393d1f00febe95854/56d15/Budget-Linewise.png 200w,\n/static/92b52b6c01c2df0393d1f00febe95854/d999c/Budget-Linewise.png 386w\"\n        sizes=\"(max-width: 386px) 100vw, 386px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n        decoding=\"async\"\n      />\n  </a>\n    </span></p>\n<p>We can read both the sheets inside the <del>budget.xlsx</del> file by passing the sheet names inside a list object to the <del>sheet_name</del> parameter.</p>\n<pre class=\"grvsc-container synthwave-84\" data-language=\"py\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"grvsc-gutter-pad\"></span><span class=\"grvsc-gutter grvsc-line-number\" aria-hidden=\"true\" data-content=\"1\"></span><span class=\"grvsc-source\"><span class=\"mtk15\">budget </span><span class=\"mtk12\">=</span><span class=\"mtk15\"> pd.</span><span class=\"mtk6\">read_excel</span><span class=\"mtk15\">(</span><span class=\"mtk16\">&quot;budget.xlsx&quot;</span><span class=\"mtk15\">, </span><span class=\"mtk8 mtki\">sheet_name</span><span class=\"mtk12\">=</span><span class=\"mtk15\">[</span><span class=\"mtk16\">&quot;ZoneWise&quot;</span><span class=\"mtk15\">, </span><span class=\"mtk16\">&quot;LineWise&quot;</span><span class=\"mtk15\">])</span></span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-gutter-pad\"></span><span class=\"grvsc-gutter grvsc-line-number\" aria-hidden=\"true\" data-content=\"2\"></span><span class=\"grvsc-source\"><span class=\"mtk15\">budget</span></span></span></code></pre>\n<p>The result is going to be a dictionary.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 525px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/3cd4b2436105bcf85661a83099159624/635dd/Dictionary.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 36%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAIAAACHqfpvAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABFklEQVQY01WQ246CMBRF/f8vM1F58kFHEUTlUCr0QnugLe2ZCJnMzHpeK9nZm4jG9zxaY40BaGoAREwxdl2ntI5xRpystbxthRBSigZAKkULm5RSipGILGJRFpfb7d1yqIE1sN1uJ++JyHu/3++kVClG53wIc1rY0A/OeyVVy1rRCwDo++54PIYQiCjG+HU+G2vpP584pURE0zg+qup0OnddJ4XUWpdlwd9v58I0TWVZNoxprfu+V1IyxsZx/I1xHK3FpmV1/RoW8PNCXdyrVVBS5vnNORdCQIvzPP+JEY0x18sly7KqujOA+vXM8+v+kK0jpRC73WGVf2evBB+GYeCcAzRKSbXAeVs9nqtgrbkVpV8uXONvWH+NUl4MMaMAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Python dictionary\"\n        title=\"Python dictionary\"\n        src=\"/static/3cd4b2436105bcf85661a83099159624/635dd/Dictionary.png\"\n        srcset=\"/static/3cd4b2436105bcf85661a83099159624/56d15/Dictionary.png 200w,\n/static/3cd4b2436105bcf85661a83099159624/d9f49/Dictionary.png 400w,\n/static/3cd4b2436105bcf85661a83099159624/635dd/Dictionary.png 525w\"\n        sizes=\"(max-width: 525px) 100vw, 525px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n        decoding=\"async\"\n      />\n  </a>\n    </span></p>\n<p>As we can see, the keys of the dictionary are the names of the worksheets.</p>\n<p>We can read a specific worksheet as follows:</p>\n<pre class=\"grvsc-container synthwave-84\" data-language=\"py\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"grvsc-gutter-pad\"></span><span class=\"grvsc-gutter grvsc-line-number\" aria-hidden=\"true\" data-content=\"1\"></span><span class=\"grvsc-source\"><span class=\"mtk15\">budget[</span><span class=\"mtk16\">&quot;ZoneWise&quot;</span><span class=\"mtk15\">]</span></span></span></code></pre>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 366px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/82b3ae7589856a681e16458e0ea92034/b18e8/Budget-zonewise.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 41.5%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAIAAAB2/0i6AAAACXBIWXMAAA7DAAAOwwHHb6hkAAABLklEQVQY022RzW6DMBCE8/6P1apJT62aNlVCAgFsIMawxj+YYBu7Sn1pJb7TajUzO9JunBjmGzI3ZPouhBD8g/CLc857b8wch7gJf9gE78PivLN+ccvi9agOh0N6vd61xhgDwHa7q+vqdPx+e//YPT+97F47gHhlEzNisBACI3Q5J0WeY4zSNG2a+vPrE2HMGAMAQsh+v29b+s8cmaYJAFBZEkKA9U3TDHw4X5Ku7621xthxVFmWcc5XzM45JVX1uANCiLZt9aSzaxrVIQQzz0VRSKVWzEopxliNMSorSluESui70+lI2naaJq21lDw5JwBsxay15oJXGDc1AQZ1Uw98SJKEdr1zj9paj2l2GYa12saY+3zvu66noJSklEqp8jwXUkaBtRZXWKkxvuoH65vFyB2ZuM4AAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Budget Zonewise\"\n        title=\"Budget Zonewise\"\n        src=\"/static/82b3ae7589856a681e16458e0ea92034/b18e8/Budget-zonewise.png\"\n        srcset=\"/static/82b3ae7589856a681e16458e0ea92034/56d15/Budget-zonewise.png 200w,\n/static/82b3ae7589856a681e16458e0ea92034/b18e8/Budget-zonewise.png 366w\"\n        sizes=\"(max-width: 366px) 100vw, 366px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n        decoding=\"async\"\n      />\n  </a>\n    </span></p>\n<p>What if we have hundreds of worksheets in the file?</p>\n<p>Then, writing the names of the worksheets manually is not a feasible option. In such cases, we can pass the value of <del>None</del> to the <del>sheet_name</del> parameter.</p>\n<pre class=\"grvsc-container synthwave-84\" data-language=\"py\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"grvsc-gutter-pad\"></span><span class=\"grvsc-gutter grvsc-line-number\" aria-hidden=\"true\" data-content=\"1\"></span><span class=\"grvsc-source\"><span class=\"mtk15\">budget </span><span class=\"mtk12\">=</span><span class=\"mtk15\"> pd.</span><span class=\"mtk6\">read_excel</span><span class=\"mtk15\">(</span><span class=\"mtk16\">&quot;budget.xlsx&quot;</span><span class=\"mtk15\">, </span><span class=\"mtk8 mtki\">sheet_name</span><span class=\"mtk12\">=</span><span class=\"mtk15\"> </span><span class=\"mtk5\">None</span><span class=\"mtk15\">)</span></span></span></code></pre>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    position: relative;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n    line-height: 1.4;\n  }\n  \n  .grvsc-code {\n    display: table;\n  }\n  \n  .grvsc-line {\n    display: table-row;\n    box-sizing: border-box;\n    width: 100%;\n    position: relative;\n  }\n  \n  .grvsc-line > * {\n    position: relative;\n  }\n  \n  .grvsc-gutter-pad {\n    display: table-cell;\n    padding-left: 0.75rem;\n    padding-left: calc(var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem)) / 2);\n  }\n  \n  .grvsc-gutter {\n    display: table-cell;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    user-select: none;\n  }\n  \n  .grvsc-gutter::before {\n    content: attr(data-content);\n  }\n  \n  .grvsc-source {\n    display: table-cell;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-source:empty::after {\n    content: ' ';\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    user-select: none;\n  }\n  \n  .grvsc-gutter + .grvsc-source {\n    padding-left: 0.75rem;\n    padding-left: calc(var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem)) / 2);\n  }\n  \n  /* Line transformer styles */\n  \n  .grvsc-has-line-highlighting > .grvsc-code > .grvsc-line::before {\n    content: ' ';\n    position: absolute;\n    width: 100%;\n  }\n  \n  .grvsc-line-diff-add::before {\n    background-color: var(--grvsc-line-diff-add-background-color, rgba(0, 255, 60, 0.2));\n  }\n  \n  .grvsc-line-diff-del::before {\n    background-color: var(--grvsc-line-diff-del-background-color, rgba(255, 0, 20, 0.2));\n  }\n  \n  .grvsc-line-number {\n    padding: 0 2px;\n    text-align: right;\n    opacity: 0.7;\n  }\n  \n  .synthwave-84 { background-color: #262335; }\n  .synthwave-84 .mtki { font-style: italic; }\n  .synthwave-84 .mtk10 { color: #FEDE5D; }\n  .synthwave-84 .mtk15 { color: #FF7EDBFF; }\n  .synthwave-84 .mtk12 { color: #FFFFFFEE; }\n  .synthwave-84 .mtk6 { color: #36F9F6; }\n  .synthwave-84 .mtk16 { color: #FF8B39; }\n  .synthwave-84 .mtk8 { color: #72F1B8; }\n  .synthwave-84 .mtk5 { color: #F97E72; }\n  .synthwave-84 .grvsc-line-highlighted::before {\n    background-color: var(--grvsc-line-highlighted-background-color, rgba(255, 255, 255, 0.1));\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, rgba(255, 255, 255, 0.5));\n  }\n</style>","frontmatter":{"title":"Reading Excel Files Using Pandas","date":"2021-08-05"}}},"pageContext":{"slug":"/reading-excel-files-using-pandas/","prev":{"fields":{"slug":"/writing-excel-files-using-pandas/"},"frontmatter":{"modules":null}},"next":{"fields":{"slug":"/review-july-2021/"},"frontmatter":{"modules":null}}}},
    "staticQueryHashes": ["3159585216"]}