title: Create file name from variable values in python
body: <p>I would like to create a .xlsx file using the name of an existing variable. I need to dynamically create the Excel name in df.to_excel for a given stock.  For example, create TSLA.xlsx for a data frame.</p>
  <pre><code>    ticker = 'TSLA'
      xlfile = ticker + &quot;.xlsx&quot;
      df=pd.read_csv(query_string)
      df.to_excel(xlfile, index=False)
  </code></pre>
  <p>I get Permission denied: 'TSLA.xlsx'</p>
  <p>However the following works just fine:</p>
  <pre><code>    df=pd.read_csv(query_string) 
      print(df)
      df.to_excel(&quot;TSLA.xlsx&quot;, index=False)
  </code></pre>
  <p>Thanks for all your help!</p>