{"id":10,"date":"2026-01-22T18:56:48","date_gmt":"2026-01-22T10:56:48","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=10"},"modified":"2026-01-17T04:22:53","modified_gmt":"2026-01-17T04:22:53","slug":"how-to-hide-and-show-worksheets-using-xlwings","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-hide-and-show-worksheets-using-xlwings\/","title":{"rendered":"How To Hide and Show Worksheets Using xlwings?"},"content":{"rendered":"<h2>Method<\/h2>\n<h3 style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\"><span style=\"font-weight: bold;\">Normal hide<\/span><\/h3>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#xlwings API<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">bk.api.Sheets(&#8216;Sheet1&#8217;).Visible = False<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#bk.api.Sheets(&#8216;Sheet1&#8217;).Visible = xw.constants.SheetVisibility.xlSheetHidden<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#bk.api.Sheets(&#8216;Sheet1&#8217;).Visible = 0<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 8.0pt;\">\u00a0<\/p>\n<h3 style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\"><span style=\"font-weight: bold;\">Deep hide<\/span><\/h3>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#xlwings API<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#bk.api.Sheets(&#8216;Sheet1&#8217;).Visible=xw.constants.SheetVisibility.xlSheetVeryHidden<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#bk.api.Sheets(&#8216;Sheet1&#8217;).Visible=2<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 8.0pt;\">\u00a0<\/p>\n<h3 style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\"><span style=\"font-weight: bold;\">Unhide<\/span><\/h3>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#xlwings<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#bk.sheets(&#8216;Sheet1&#8217;).visible = True<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#bk.sheets(&#8216;Sheet1&#8217;).visible = 1<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 8.0pt;\">\u00a0<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#xlwings API<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#bk.api.Sheets(&#8216;Sheet1&#8217;).Visible = True<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#bk.api.Sheets(&#8216;Sheet1&#8217;).Visible = xw.constants.SheetVisibility.xlSheetVisible<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#bk.api.Sheets(&#8216;Sheet1&#8217;).Visible = 1<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#bk.api.Sheets(&#8216;Sheet1&#8217;).Visible = -1<\/p>\n<h2>Sample Code<\/h2>\n\n\n<pre class=\"wp-block-code\"><code>#Hiding and Showing Worksheets\n\nimport xlwings as xw    #Import the xlwings package\n\napp=xw.App()\nbk=app.books.active    #Get the active workbook\nsht=bk.sheets.active    #Get the active worksheet\nsht2=bk.sheets.add()\n\n#Normal hide\n#xlwings API\n#bk.api.Sheets('Sheet1').Visible = False \n#bk.api.Sheets('Sheet1').Visible = xw.constants.SheetVisibility.xlSheetHidden\n#bk.api.Sheets('Sheet1').Visible = 0\n\n#Deep hide\n#xlwings API\nbk.api.Sheets('Sheet1').Visible=xw.constants.SheetVisibility.xlSheetVeryHidden\n#bk.api.Sheets('Sheet1').Visible=2\n\n#Unhide\n#xlwings\nbk.sheets('Sheet1').visible = True\n#bk.sheets('Sheet1').visible = 1\n\n#xlwings API\n#bk.api.Sheets('Sheet1').Visible = True\n#bk.api.Sheets('Sheet1').Visible = xw.constants.SheetVisibility.xlSheetVisible\n#bk.api.Sheets('Sheet1').Visible = 1\n#bk.api.Sheets('Sheet1').Visible = -1\n\n#bk.close()\n#app.kill()<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Method<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-10","post","type-post","status-publish","format-standard","hentry","category-xlwings-worksheet"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/comments?post=10"}],"version-history":[{"count":3,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/10\/revisions"}],"predecessor-version":[{"id":227,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/10\/revisions\/227"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}