title: Error while trying to export a pandas dataframe as an excel file
body: <p>I'm trying to send a pandas dataframe to C directory as a excel file</p>
  <pre><code>df=pd.DataFrame([[1,3,5],[2,4,6]],index=['a1','a2'], columns=['b1','b2','b3'])
  df.to_excel('C:/df1.xlsx',sheet_name='data')
  </code></pre>
  <p>This code gives me an error message such as</p>
  <pre><code>PermissionError                           Traceback (most recent call last)
  ~\AppData\Local\Temp/ipykernel_13136/2106016881.py in &lt;module&gt;
  ----&gt; 1 df.to_excel('C:/df1.xlsx',sheet_name='data')
  
  ~\anaconda3\lib\site-packages\pandas\core\generic.py in to_excel(self, excel_writer, sheet_name, na_rep, float_format, columns, header, index, index_label, startrow, startcol, engine, merge_cells, encoding, inf_rep, verbose, freeze_panes, storage_options)
     2282             inf_rep=inf_rep,
     2283         )
  -&gt; 2284         formatter.write(
     2285             excel_writer,
     2286             sheet_name=sheet_name,
  
  ~\anaconda3\lib\site-packages\pandas\io\formats\excel.py in write(self, writer, sheet_name, startrow, startcol, freeze_panes, engine, storage_options)
      832             # error: Cannot instantiate abstract class 'ExcelWriter' with abstract
      833             # attributes 'engine', 'save', 'supported_extensions' and 'write_cells'
  --&gt; 834             writer = ExcelWriter(  # type: ignore[abstract]
      835                 writer, engine=engine, storage_options=storage_options
      836             )
  
  ~\anaconda3\lib\site-packages\pandas\io\excel\_xlsxwriter.py in __init__(self, path, engine, date_format, datetime_format, mode, storage_options, if_sheet_exists, engine_kwargs, **kwargs)
      189             raise ValueError(&quot;Append mode is not supported with xlsxwriter!&quot;)
      190 
  --&gt; 191         super().__init__(
      192             path,
      193             engine=engine,
  
  ~\anaconda3\lib\site-packages\pandas\io\excel\_base.py in __init__(self, path, engine, date_format, datetime_format, mode, storage_options, if_sheet_exists, engine_kwargs, **kwargs)
      923         self.handles = IOHandles(cast(Buffer, path), compression={&quot;copression&quot;: None})
      924         if not isinstance(path, ExcelWriter):
  --&gt; 925             self.handles = get_handle(
      926                 path, mode, storage_options=storage_options, is_text=False
      927             )
  
  ~\anaconda3\lib\site-packages\pandas\io\common.py in get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)
      708         else:
      709             # Binary mode
  --&gt; 710             handle = open(handle, ioargs.mode)
      711         handles.append(handle)
      712 
  
  PermissionError: [Errno 13] Permission denied: 'C:/df1.xlsx'
  </code></pre>
  <p>Not really sure where the problem is being caused
  Can anyone help me how to solve this?</p>