Comments (14)
So it seems that there is a problem not with rails, but with irb
to reproduce
irb
> require 'spreadsheet'
> Spreadsheet.open 'my_file.xls'
does anybody else have this problem with their files?
same problem with pry. eats up gigabytes of memory and grows and grows
from spreadsheet.
OKAY, so my real problem is that Workbook cannot be nicely printed...
> book = Spreadsheet.open 'my_file.xls';nil
=> nil
works fine, but then
> book
again waits forever...
there's some sort of infinite loop in the inspection code...
from spreadsheet.
the culprit seems to be that workbook#inspect loops over all its instance variables, and so does worksheet.... does worksheet keep a reference back to workbook somewhere?
from spreadsheet.
How was the file "my_file.xls" created? Did you create that file with MS Office, LibreOffice or with spreadsheet?
from spreadsheet.
I have the same problem with memory in irb under Ruby 1.9.3. No problem under 1.8.7
from spreadsheet.
interesting.
from spreadsheet.
Ditto. Same problem under irb, ruby 1.9.3 (installed from RVM if that matters).
from spreadsheet.
BiggerNoise: What is your sample code? What are you trying to do?
from spreadsheet.
Sample is:
require 'spreadsheet'
wb = Spreadsheet.open('./tmp/analysis.summary.xls')
If I try and run this under irb, it will exhaust the memory on my machine (starting from ~8GiB).
However, if I just put this in a script, it will run fine. I am able to see the worksheets and get row and column counts.
As far as what I am trying to accomplish, my ultimate goal is to take the spreadsheet that this analysis program produces and import it into my rails application. I may need to jump through some hoops to make that happen in a reasonably performant way, but the first step will be reading the spreadsheet.
Let me know if that answers your questions.
from spreadsheet.
Yes, it does answer my question. I do not know why irb is exhausting your memory. Are you on Linux or Windows or Mac?
from spreadsheet.
I am running Mac (10.7). And, if it helps:
andy@Andy-MBP:Crucible $ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
I did follow the advice that I found elsewhere and shutdown irb's inspection of the workbook:
wb = Spreadsheet.open('./tmp/analysis.summary.xls'); nil
That allows me to work in irb.
from spreadsheet.
Awesome! Can you post analysis.summary.xls somewhere please and link it here.
from spreadsheet.
I am trying to make a spreadsheet where I can reproduce the problem. Unfortunately, I can't post the one that is actually giving me grief. I will see what I can do and get back to you.
from spreadsheet.
Also see:
https://groups.google.com/d/msg/rubyspreadsheet/vkHOulBnjMc/r792XlGEWLsJ
and
https://gist.github.com/4636781
from spreadsheet.
Related Issues (20)
- File `xls` styles not appearing if open by google doc HOT 2
- How to add a picture HOT 3
- Cells with text >= 32KB in length result in MS Excel failing to open HOT 6
- What's the plan about TODO (Percent style)? HOT 3
- Seemingly empty file after adding 'too many' rows HOT 1
- Cannot write spreadsheet to an already opened file HOT 15
- Save Images from Excel Spreadsheets HOT 1
- Editing existing excel HOT 8
- Failing to read XLS file: process doesn't terminate. HOT 6
- Complex Excel Structure -> Cells location jumbled upon saving HOT 13
- Error opening a spreadsheet created by this gem HOT 5
- No read Excel rows more then 65353 HOT 4
- Create an excel file with more than 256 columns HOT 5
- Adding styling to a sheet tab HOT 5
- Formula referencing value in different sheet is broken HOT 8
- Max rows count HOT 10
- Incorrect MIME type HOT 1
- Format missing after certain rows and columns HOT 7
- Workbook problem HOT 1
- Images & formatting lost after writing to existing file HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spreadsheet.