title: Openpyxl and Hidden/Unhidden Excel Worksheets
body: <p>I have the following code that reads data from a tab-delimited text file and then writes it to a specified worksheet within an existing Excel workbook. The variables "workbook", "write_sheet", and "text_file" are input by the user</p>
  
  <pre><code>tab_reader = csv.reader(text_file, delimiter='\t')
  xls_book = openpyxl.load_workbook(filename=workbook)
  sheet_names = xls_book.get_sheet_names()
  xls_sheet = xls_book.get_sheet_by_name(write_sheet)
  for row_index, row in enumerate(tab_reader):
          number = 0
          col_number = first_col
          while number &lt; num_cols:
                  cell_tmp = xls_sheet.cell(row = row_index, column = col_number)
                  cell_tmp.value = row[number]
                  number += 1
                  col_number += 1
  xls_book.save(workbook)
  </code></pre>
  
  <p>However when I run this code on a preexisting "workbook" in which "worksheet" is a hidden tab, the output unhides the tab. I think the reason is because openpyxl is not modifying the file but creating a new file entirely. Is there an easy way to tell python to check if the worksheet is hidden and then output a hidden or unhidden sheet based on whether or not the condition is satisfied?</p>
  
  <p>Thanks! </p>