title: How to automatically load the excel workbook with multiple worksheets in R
body: <p>I am very new to R, and am reading an excel file (size 27,964 KB) into R using <code>read.xlsx</code> from library <code>open.xlsx</code>. </p>
  
  <pre><code>filename = "myfile.xlsx"
  df1 = read.xlsx(filename, sheet="df1",colNames= TRUE)
  df2 = read.xlsx(filename, sheet="df2",colNames= TRUE)
  </code></pre>
  
  <p>There are multiple sheets in the excel file. Right now I am reading one sheet at a time, but I want to automate the process and be able to create data frames according to sheet names.</p>
  
  <p>I read we can use <code>XLConnect</code> for this purpose, but when I tried <code>XLConnect</code> in my case, I got the an error</p>
  
  <pre><code>wb = loadWorkbook("myfile.xlsx")
  Error: OutOfMemoryError (Java): GC overhead limit exceeded
  </code></pre>
  
  <p>In order to fix this error I used</p>
  
  <pre><code>options(java.parameters = "-Xmx1024m")/"Xmx2g"
  </code></pre>
  
  <p>but both the options did not help. I tried reading about exce.link but could not really figure it out.</p>
  
  <p>Can some one please guide how to use another method to read excel file with multiple sheets. </p>