I am trying to import some rows and columns from a large excel file, but I get this error

There was insufficient Java heap space for the operation. Try increasing the Java Virtual Machine heap size.

What's interesting, is that this error shows up even if I try to import just a cell from the file, like

Import["path/to/file.xls", {"Data", 1, 1, 1}]

It still gives an error. That seems wrong, since a single cell does not take any space in memory!

  • 1
    $\begingroup$ Import internally imports the whole thing before extracting the part. You may even do better to simply do Import["file.xls"][[1,1,1]] $\endgroup$ – george2079 Aug 25 '17 at 20:37
  • 1
    $\begingroup$ @george2079 Wow, that's crazy inefficient! $\endgroup$ – becko Aug 25 '17 at 20:43
  • 1
    $\begingroup$ sure is. Might make the same comment about storing large data in excel in the first place :-) $\endgroup$ – george2079 Aug 25 '17 at 21:37
  • $\begingroup$ @george2079 Not my fault. It was handed to me this way. Regrettably many people seem to like this format, I do not. $\endgroup$ – becko Aug 25 '17 at 21:44
  • $\begingroup$ It is large with many sheets, or a single sheet is large? Splitting each sheet up into its own file might not be too difficult. $\endgroup$ – user6014 Aug 25 '17 at 23:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.