0

I am very new to R, and am reading an excel file (size 27,964 KB) into R using read.xlsx from library open.xlsx.

filename = "myfile.xlsx"
df1 = read.xlsx(filename, sheet="df1",colNames= TRUE)
df2 = read.xlsx(filename, sheet="df2",colNames= TRUE)

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.

I read we can use XLConnect for this purpose, but when I tried XLConnect in my case, I got the an error

wb = loadWorkbook("myfile.xlsx")
Error: OutOfMemoryError (Java): GC overhead limit exceeded

In order to fix this error I used

options(java.parameters = "-Xmx1024m")/"Xmx2g"

but both the options did not help. I tried reading about exce.link but could not really figure it out.

Can some one please guide how to use another method to read excel file with multiple sheets.

MichaelChirico
  • 33,841
  • 14
  • 113
  • 198
nasia jaffri
  • 803
  • 2
  • 12
  • 21
  • Did you try `options( java.parameters = "-Xmx4g" )`? Also, you need to run this *before the JVM is loaded*, so restart your R session and make this the very first command. – jlhoward Nov 04 '14 at 22:49
  • I ran it as a first line with "2g" instead of "4g", as my total RAM is 4g. I got the following error, Error: OutOfMemoryError (Java): Java heap space – nasia jaffri Nov 05 '14 at 01:55

0 Answers0