title: IndexError: At least one sheet must be visible reading from a CSV file
body: <p>I have a CSV file that looks like this:</p>
  
  <pre><code>first-name,last-name,email-address
  Yes,Beth,bethfat@gmail.com
  Iran,Dajango,django@me.com
  Paul,Walker,info@walker.com
  Ray,Johnson,JJRay@gmail.com
  </code></pre>
  
  <p>I'm trying to convert this CSV file into a Excel file for further use by using Pandas. How I'm doing so is by reading the data from a webpage:</p>
  
  <pre><code>import requests
  
  def get_data(url):
      headers = {
          "Connection": "close",
          "User-Agent": "TBG/Converter (TBG;file-converter)"
      }
      req = requests.get(url, headers=headers)
      return req.content
  
  
  def parse_html(html):
      retval = {}
      data = html.split("&lt;/head&gt;")
      data = data[-1]
      data = data.split("\n")
      retval["header"] = data[0].strip()
      data = data[1:-1]
      emails = set()
      for email in data:
          emails.add(email.split("&lt;br&gt;")[-1])
      retval["userInformation"] = list(emails)
      return retval
  </code></pre>
  
  <p>And writing it to a temporary CSV file:</p>
  
  <pre><code>import pandas as pd
  
  def write_to_xlsx(data_dict, filename):
      tmp_filename = "/tmp/{}.csv".format(rand())
      with open(tmp_filename, "a+") as tmp:
          data = [data_dict["header"]]
          for item in data_dict["userInformation"]:
              item = item.split(",")
              item = ",".join([c.strip() for c in item])
              data.append(item)
          csv_format = "\n".join(data)
          tmp.write(csv_format)
      print tmp_filename
      with pd.ExcelWriter(filename) as ew:
          pd.read_csv(tmp_filename).to_excel(
              ew, index=False, sheet_name=tmp_filename.split(".")[0], encoding="utf-8"
          )
          ew.save()
  </code></pre>
  
  <p>During the writing of the Excel file I get an error telling me:</p>
  
  <pre><code>Traceback (most recent call last):
    File "converter.py", line 70, in &lt;module&gt;
      write_to_xlsx(sorted_data, config["filename"].format(str(datetime.datetime.now()).split(" ")[0]))
    File "converter.py", line 63, in write_to_xlsx
      ew.save()
    File "/Users/admin/bin/python/printers/venv/mailchimper/lib/python2.7/site-packages/pandas/io/excel.py", line 985, in __exit__
      self.close()
    File "/Users/admin/bin/python/printers/venv/mailchimper/lib/python2.7/site-packages/pandas/io/excel.py", line 989, in close
      return self.save()
    File "/Users/admin/bin/python/printers/venv/mailchimper/lib/python2.7/site-packages/pandas/io/excel.py", line 1018, in save
      return self.book.save(self.path)
    File "/Users/admin/bin/python/printers/venv/mailchimper/lib/python2.7/site-packages/openpyxl/workbook/workbook.py", line 367, in save
      save_workbook(self, filename)
    File "/Users/admin/bin/python/printers/venv/mailchimper/lib/python2.7/site-packages/openpyxl/writer/excel.py", line 284, in save_workbook
      writer.save(filename)
    File "/Users/admin/bin/python/printers/venv/mailchimper/lib/python2.7/site-packages/openpyxl/writer/excel.py", line 266, in save
      self.write_data()
    File "/Users/admin/bin/python/printers/venv/mailchimper/lib/python2.7/site-packages/openpyxl/writer/excel.py", line 95, in write_data
      archive.writestr(ARC_WORKBOOK, write_workbook(self.workbook))
    File "/Users/admin/bin/python/printers/venv/mailchimper/lib/python2.7/site-packages/openpyxl/writer/workbook.py", line 94, in write_workbook
      active = get_active_sheet(wb)
    File "/Users/admin/bin/python/printers/venv/mailchimper/lib/python2.7/site-packages/openpyxl/writer/workbook.py", line 61, in get_active_sheet
      raise IndexError("At least one sheet must be visible")
  IndexError: At least one sheet must be visible
  </code></pre>
  
  <p>What is causing this issue, and how can I fix it?</p>