Partial Load Excel EPPlus C#

风流意气都作罢 提交于 2019-12-25 12:42:08

问题


It is to my understanding that EPPlus loads the entire Excel file into memory which is creating a performance hit. I was wondering if there is a way to partially load Excel into EPPlus to read a small range of rows? I'm using EPPlus version 4.0.4.

For instance, I can open a CSV file and read just a small range of rows/lines and performance is good. The CSV file could contain way more then a million rows/lines.

IEnumerable<string> lines = System.IO.File.ReadLines(filePath).Skip(0).Take(20).ToList();

回答1:


I don't think that will be possible.

CSV files are just plain text files. That means you can seek and read whatever point in the file you want to.

Excel files (.xlsx) are really just ZIP files, the data contained within is various XML files that describe the contents. So since it's compressed, you can't really partially load the file.

If you want to see what's in a .xlsx file, just change the extension on it to .zip, then use your favorite extraction tool to look at the contents.



来源:https://stackoverflow.com/questions/32743720/partial-load-excel-epplus-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!