Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing without entire spreadsheet in memory #42

Closed
njvack opened this issue Jul 18, 2012 · 4 comments
Closed

Writing without entire spreadsheet in memory #42

njvack opened this issue Jul 18, 2012 · 4 comments

Comments

@njvack
Copy link

njvack commented Jul 18, 2012

Hi,

I'm looking to write hundreds of thousands of rows to an Excel spreadsheet in a web app. Keeping it all in memory is no fun; I'd like to write it straight to the output stream. Looking at the API, it doesn't look like that's something I can do -- am I correct?

If so, would this be something that's fairly easy to implement? Or even possible?

Thanks!

@amanfredi
Copy link
Collaborator

I think supporting this would be quite challenging. The XML data format is not friendly in any way. As I recall, Excel itself does not handle large spreadsheets very gracefully.

@brazir
Copy link
Contributor

brazir commented Jul 25, 2012

older versions of excel i think were limited to 64k lines and newer versions implement some kind of paging so performance in newer versions of excel shouldn't be that terrible. However, as amenfredi commented it wouldn't be a simple task to implement a stream if you are looking into this and you only need to output it then you should be able to just have a blank excel file saved some where and then you could copy it open the archive and read in the excel worksheet and then just insert a bunch of cells as text.

  1. read in the file
  2. print the top half of the file to some new file
  3. transform the data row you have and then output it should be simple
  4. print the bottom of the file

in the archive the file would be in xl > worksheets > sheet1.xml
the section you would add it into is sheetdata
and example of a row is


0

@brazir
Copy link
Contributor

brazir commented Jul 25, 2012

lol github converted the xml I included

they look basicaly like
row r="1"
c r="A1" s="1" t="s"
v 0 /v
/c
/row

@weshatheleopard
Copy link
Owner

The problem is that the files are severely interconnected. Besides, how do you imagine further manipulating that Excel file in, well, Excel without loading it into memory? I'm afraid this request is not doable.

aliismayilov pushed a commit to aliismayilov/rubyXL that referenced this issue Mar 9, 2021
bugfix: get correct size for utf8 strings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants