title: Using read_excel to upload and automatically name all existing workbook sheets (without specifying the number of sheets)
body: <p>I would like to adapt the answer below, taken from <a href="https://stackoverflow.com/questions/71823131/replacing-dots-with-underscores-when-using-make-names-or-renaming-obejcts-in-th">this question</a>.</p>
  <pre><code># Example data
  write.xlsx(mtcars, &quot;mt cars.xlsx&quot;)
  write.xlsx(mtcars, &quot;mt car s.xlsx&quot;)
  
  temp = list.files(pattern=&quot;*.xlsx&quot;)
  
  make_names &lt;- function(x) {
    gsub(&quot;\\.&quot;, &quot;_&quot;, make.names(gsub(&quot;*.xlsx$&quot;, &quot;&quot;, x)))
  }
  names(temp) &lt;- make_names(temp)
  
  list2env(lapply(temp, read.xlsx), envir = .GlobalEnv)
  #&gt; &lt;environment: R_GlobalEnv&gt;
  
  ls()
  #&gt; [1] &quot;make_names&quot; &quot;mt_car_s&quot;   &quot;mt_cars&quot;    &quot;temp&quot;
  </code></pre>
  <p>Let's assume that one of the Excel files has a second sheet (I tried to create a replicatable, but could not figure out how to write a second sheet with <code>write.xlsx</code>).</p>
  <p>The code to load all Excel sheets from one Excel-file can be found <a href="https://stackoverflow.com/questions/12945687/read-all-worksheets-in-an-excel-workbook-into-an-r-list-with-data-frames">here</a>, (thanks to akrun). However in my case I am trying to upload a folder instead of a file.</p>
  <p>How can I combine this code to do both of these things?</p>
  <p>Is there an option to look for more sheets?</p>