title: Importing a big xlsx file into R?
body: <p>I'm wondering if anyone knows of a way to import data from a "big" xlsx file (~20Mb). I tried to use xlsx and XLConnect libraries. Unfortunately, both use rJava and I always obtain the same error:</p>
  
  <pre><code>&gt; library(XLConnect)
  &gt; wb &lt;- loadWorkbook("MyBigFile.xlsx")
  Error: OutOfMemoryError (Java): Java heap space
  </code></pre>
  
  <p>or </p>
  
  <pre><code>&gt; library(xlsx)
  &gt; mydata &lt;- read.xlsx2(file="MyBigFile.xlsx")
  Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  : 
     java.lang.OutOfMemoryError: Java heap space
  </code></pre>
  
  <p>I also tried to modify the java.parameters before loading rJava:</p>
  
  <pre><code>&gt; options( java.parameters = "-Xmx2500m")
  &gt; library(xlsx) # load rJava
  &gt; mydata &lt;- read.xlsx2(file="MyBigFile.xlsx")
  Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  : 
     java.lang.OutOfMemoryError: Java heap space
  </code></pre>
  
  <p>or after loading rJava (this is a bit stupid, I think):</p>
  
  <pre><code>&gt; library(xlsx) # load rJava
  &gt; options( java.parameters = "-Xmx2500m")
  &gt; mydata &lt;- read.xlsx2(file="MyBigFile.xlsx")
  Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  : 
     java.lang.OutOfMemoryError: Java heap space
  </code></pre>
  
  <p>But nothing works. Does anyone have an idea?</p>