title: Write dictionary of dataframes to separate excel sheets
body: <p>I have a dictionary containing a dataframe for each state in 'data.csv.'</p>
  
  <pre><code>df=pd.read_csv('data.csv')
  
  dict_of_st = {k: v for k, v in df.groupby('Preferred State/Province')}
  </code></pre>
  
  <p>I would like to write each dataframe to a separate excel sheet in an workbook that already exists ('test.xlsx'). </p>
  
  <p>I tried using a for loop and <code>load workbook</code></p>
  
  <pre><code>from openpyxl import load_workbook
  
  book = load_workbook('test.xlsx')
  writer = pd.ExcelWriter('test.xlsx', engine='openpyxl') 
  writer.book = book
  writer.sheets = dict((ws.title, ws) for ws in book.worksheets)
  
  for i in dict_of_st:
      i.to_excel(writer, sheet_name=i)
  
  writer.save()
  </code></pre>
  
  <p>but jupyter notebook raises this error:</p>
  
  <pre><code>AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-8-c1ba1b4d53d8&gt; in &lt;module&gt;
        7 
        8 for i in dict_of_st:
  ----&gt; 9     i.to_excel(writer, sheet_name=i)
       10 
       11 writer.save()
  
  AttributeError: 'str' object has no attribute 'to_excel'
  </code></pre>