如何使用java实现大型xlsm文件 [英] How to real large xlsm file using java

查看:946
本文介绍了如何使用java实现大型xlsm文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Sir,

Can U please provide me solution for this.

I have One xlsm file In that 28000 record. I want to read that record and getting some filter So while reading time I got below error.

Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded

I increase my memory but Still I got this exception. I am using below code .

  

Can U please suggest me how to load and read this file?

Thanks in advance





我尝试过:



文件f =新文件(sample.xlsx);

FileInputStream ios = new FileInputStream(f);

XSSFWorkbook工作簿=新的XSSFWorkbook(ios);

XSSFSheet sheet = workbook.getSheetAt(0);



What I have tried:

File f = new File("sample.xlsx");
FileInputStream ios = new FileInputStream(f);
XSSFWorkbook workbook = new XSSFWorkbook(ios);
XSSFSheet sheet = workbook.getSheetAt(0);

推荐答案

明显错误。您正在使用像数据库这样的巨大XLSM文件。在内存使用和处理器资源方面做得更糟,这很复杂。

像所有excel文件一样的xlsm文件必须全部加载,因此你的内存问题。

Excel不是擅长数据库,对于每个请求,它将扫描所有28000条记录。



为了提供一个好的建议,您需要向我们提供有关此数据文件的详细信息。 br />
是否随时间变化?

是否适合数据库?

文件大小?

结构?

用法?
Plain wrong. You are using a huge XLSM file like a databases. It is complicated to do worse in memory usage and processor resources.
An xlsm file like all excel file must be loaded in full, thus your memory problem.
Excel is not good at database, for each request it will scan all 28000 records.

In order to give a good advice, you need to give us details about this data file.
Does it change with time ?
Does it fit to a database ?
File size ?
Structure ?
Usage ?


最好先查看文档。请参阅 XSSFWorkbook(POI API文档)中的评论) [ ^ ]。
It is always best to check the documentation first. See the comments at XSSFWorkbook (POI API Documentation)[^].


这篇关于如何使用java实现大型xlsm文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆