How to upload a large excel file

How to upload a large excel file

Dear sir ,
How to upload a large excel file and how to read a that large excel file or how to get a each column values from that large excel file.For small file i am getting values but for large file my code is not working so please help me sir i have used u r uploadandstore code for uploading and it is working fine but now i want to get a seperately each column values from that large file ,i used the following code.

/// For file uploading i have used the following code

String saveFile = "";
contentType = request.getContentType();
if ((contentType != null)
&& (contentType.indexOf("multipart/form-data") >= 0)) {
DataInputStream in = new DataInputStream(request
.getInputStream());
int formDataLength = request.getContentLength();
byte dataBytes[] = new byte[formDataLength];
int byteRead = 0;
int totalBytesRead = 0;
while (totalBytesRead < formDataLength) {
byteRead = in.read(dataBytes, totalBytesRead,
formDataLength);
totalBytesRead += byteRead;
}
String file = new String(dataBytes);
saveFile = file.substring(file.indexOf("filename=\"") + 10);
//System.out.println("saved file is " + saveFile);
saveFile = saveFile.substring(0, saveFile.indexOf("\n"));
//System.out.println("saved file is " + saveFile);
saveFile = saveFile.substring(saveFile.lastIndexOf("\\") + 1,
saveFile.indexOf("\""));
//System.out.println("saved file is " + saveFile);
int lastIndex = contentType.lastIndexOf("=");
String boundary = contentType.substring(lastIndex + 1,
contentType.length());
int pos;
pos = file.indexOf("filename=\"");
pos = file.indexOf("\n", pos) + 1;
pos = file.indexOf("\n", pos) + 1;
pos = file.indexOf("\n", pos) + 1;
int boundaryLocation = file.indexOf(boundary, pos) - 4;
startPos = ((file.substring(0, pos)).getBytes()).length;
endPos = ((file.substring(0, boundaryLocation)).getBytes()).length;
saveFile = "E:/workspace/harini/MassEmailSending/SmallProjectOnMassEmailSending/WebContent/file/" + saveFile;
System.out.println("saved file is "+saveFile);
File f = new File(saveFile);
FileOutputStream fileOut = new FileOutputStream(f);
fileOut.write(dataBytes, startPos, (endPos - startPos));
fileOut.flush();
fileOut.close();
}


/// For reading a excel file i used the following code with apache poi

if (filename != null && !filename.equals("")) {//1
try {//2
/*int l=0;
for(int i=0;i<arlMessage.size();i++){
String str = (String) arlMessage.get(i);
String s=str.replace("~","");
int intValue=Integer.parseInt(s);
intValue-=1;*/

FileInputStream fs = new FileInputStream(strFileAttachment);
Attachment = strFileAttachment.split("\n");
HSSFWorkbook wb = new HSSFWorkbook(fs);
for (int k = 0; k < wb.getNumberOfSheets(); k++) {//3
HSSFSheet sheet = wb.getSheetAt(k);
int rows = sheet.getPhysicalNumberOfRows();
for (int r = 1; r < rows; r++) {//4
HSSFRow row = sheet.getRow(r);
if (row != null) {//5
int cells = row.getPhysicalNumberOfCells();

// int l=0;
HSSFCell cell = row.getCell(0);
if (cell != null) {//6
//String value = null;
switch (cell.getCellType()) {//7
case HSSFCell.CELL_TYPE_FORMULA:
value = "FORMULA ";
break;

case HSSFCell.CELL_TYPE_NUMERIC:
value = "" + cell.getNumericCellValue();
break;

case HSSFCell.CELL_TYPE_STRING:
value = cell.getStringCellValue();
break;

default:
}//7
%><%--=value--%><input type="hidden" name="email" value="<%=value%>">


Using this code i am getting nothing values if i upload a large file ,if i upload a small file it works fine .Where my code going wrong i am not getting so please help me sir.


Thanks and Regards
Harini Veerapur.
View Answers









Related Tutorials/Questions & Answers:
How to upload a large excel file - JSP-Servlet
How to upload a large excel file   Dear sir , How to upload a large excel file and how to read a that large excel file or how to get a each column values from that large excel file.For small file i am getting values
Excel File data upload into postgresql database in struts 1.x
Excel File data upload into postgresql database in struts 1.x  Dear members please explain how Excel Files data upload into postgresql database in struts 1.x
Advertisements
How to Split a large XML file using java?
How to Split a large XML file using java?  How can we split a 500MB Xml file?I know how to split xml file after reading the entire document in a file.Here we cannot load the entire file as it is a large file
upload a file into database and progrm should support excel and text and csv file formats
upload a file into database and progrm should support excel and text and csv file formats  Hai all, I need a program to upload a file into database table... and the program should support .excel ,.txt ,.csv file formats. can
how to use Excel Templet to write excel file using java.
how to use Excel Templet to write excel file using java.  how to use Excel Templet to write excel file using java
How to Increase Upload File Size Limit in php
How to Increase Upload File Size Limit in php  Increase Upload File.... But the default file upload size settings restrict you to upload large files. PHP.... This setting also affects file upload. To upload large files, this value must
how to use Excel Template to write excel file using java
how to use Excel Template to write excel file using java  How to use Excel template to write data in that file using java
How to upload file on FTP Server
How to upload file on FTP Server  In my application there is a requirement of uploading the file on FTP server. How to upload file on FTP Server... is good and can be used in Java applications. Read FTP File Upload in Java for more
How to upload and download file in hadoop?
How to upload and download file in hadoop?  Hi, I am trying to learn to upload the file on the Hadoop HDFS and then download the same file for learning the process. How to upload and download file in hadoop? What
how to create an excel file using java
how to create an excel file using java  how to create an excel file using java
how to insert excel file into mysql datbase in servlet
how to insert excel file into mysql datbase in servlet  emphashow to insert excel file into mysql datbase inservletized text
Upload and Download Large files in jsp
Upload and Download Large files in jsp  I am not able to download large files (>200mb) from any server. I need a code to download and upload large files (atleast 4 gb) to a server using jsp page
how to upload a file - JSP-Servlet
how to upload a file  Dear sir, Give me some code...: Display file upload form to the user UPLOAD THE FILE   Choose the file To Upload:   2
ModuleNotFoundError: No module named 'dash-large-upload'
named 'dash-large-upload' How to remove the ModuleNotFoundError: No module named 'dash-large-upload' error? Thanks   Hi, In your...ModuleNotFoundError: No module named 'dash-large-upload'  Hi, My
ModuleNotFoundError: No module named 'dash-large-upload-component'
: No module named 'dash-large-upload-component' How to remove the ModuleNotFoundError: No module named 'dash-large-upload-component' error? Thanks...ModuleNotFoundError: No module named 'dash-large-upload-component'  
ModuleNotFoundError: No module named 'dash-large-upload'
named 'dash-large-upload' How to remove the ModuleNotFoundError: No module named 'dash-large-upload' error? Thanks   Hi, In your...ModuleNotFoundError: No module named 'dash-large-upload'  Hi, My
ModuleNotFoundError: No module named 'dash-large-upload-component'
: No module named 'dash-large-upload-component' How to remove the ModuleNotFoundError: No module named 'dash-large-upload-component' error? Thanks...ModuleNotFoundError: No module named 'dash-large-upload-component'  
How to upload file using JSP?
How to upload file using JSP?   Hi all, I m the beginner in JSP, I want to upload file on server in specific folder.   1)page.jsp... file upload form to the user</TITLE></HEAD> <
How to insert rows from Excel spreadsheet into database by browsing the excel file?
the excel file using file browsing dialogue through form in JSP. How can i select...How to insert rows from Excel spreadsheet into database by browsing the excel file?  I want to insert rows from excel sheet to database.for this i
how to upload file using FTP in java
how to upload file using FTP in java  hai, i want to upload file using FTP in java Webservices.. Tel me some Articles Regards Asha
how to display the excel file content in the jsp
how to display the excel file content in the jsp  How to present the content of the newly created excel file in the following jsp to the web browser...="application/vnd.ms-excel" %> <%@ page import="java.io.*" %> <
How to read a large text file line by line in java?
How to read a large text file line by line in java?  I have been assigned a work to read big text file and extract the data and save into database... you kind advice and let's know how to read a large text file line by line in java
How do I read a large file quickly in Java?
How do I read a large file quickly in Java?  Hi, I my project I have... in 1-2 GB in size. What is the best way to read the file efficiently? How do I read a large file quickly in Java? Thanks   Hi, You can't read the whole
Java MappedByteBuffer example, How to create a large size file in java.
Java MappedByteBuffer example, How to create a large file in java. In this tutorial, you will see how to create a large file with the help...;} } Output C:\>java CreateFile File
how to display the output of the newly created excel file
how to display the output of the newly created excel file  the following program will create the test.xlsx file, how can i display the content of the test.xlsx file in the web browser? thanks, %@ page import
how to display the excel file in the web browser.
how to display the excel file in the web browser.  > %@ page.../vnd.ms-excel" > %> <%@ page import="java.io.*" %> <% >... FileOutputStream > ("c:\\excel\\aqtemplate.xlsx"); > wb.write
Struts upload file - Framework
Struts upload file  Hi, I have upload a file from struts application.I am able to get the file name using getFileName() i created excel file and send to file upload struts..how to get the sheets and data in that sheets
File Upload
File Upload  when i execute the image upload to mysql database it shows an exception that file path cannot be found
How I Upload File and Store that file name in Database using JSP
How I Upload File and Store that file name in Database using JSP  Hi All, I m the beginner in JSP and I want to upload the file and store that file... form like Emp name, Emp id, city, address and one employee profile image(upload
How to delete excel file records using Store Procedure?
How to delete excel file records using Store Procedure?  Hi.. I have created one Excel file through stored procedure.Now I want to delete records or delete excel file. Thanks
File Upload in Struts.
File Upload in Struts.  How to do File Upload in Struts
How to upload and save a file in a folder - Java Beginners
How to upload and save a file in a folder  Hi How to upload and save a file in a folder? for example Agreement.jsp File: So when user browses the file and enters the submit button the respective file should
How to link a excel file with a application software using java swing
How to link a excel file with a application software using java swing  I have to link an excel file with a application software which I am developing.The excel file will contain questionnaire for surveys.I have this code which
How to link an excel file with the application software using java swing
How to link an excel file with the application software using java swing  I have to link an excel file with a application software which I am developing.The excel file will contain questionnaire for surveys.I have this code which
How to link a excel file with a application software using java swing
How to link a excel file with a application software using java swing  I have to link an excel file with a application software which I am developing.The excel file will contain questionnaire for surveys.I have this code which
How to browse excel file and stored the contents into the database using jsp/servlet?
How to browse excel file and stored the contents into the database using jsp/servlet?  Hi.. I want to browse excel file and stored the file data into the My-sql database using jsp/servlet
How to export data from html file to excel sheet by using java
How to export data from html file to excel sheet by using java    How to export data from html file to excel sheet by using java
How to import data from sql server table into an excel file by creating the rows dynamically in the excel according to the dataabase??
How to import data from sql server table into an excel file by creating the rows dynamically in the excel according to the dataabase??  How to import data from sql server table into an excel file by creating the rows dynamically
How to open excel sheet when excel file is placed in some folder in desktop
How to open excel sheet when excel file is placed in some folder in desktop  How to open an excel sheet using windows.open in IE... I am getting an error msg that the path is not correct.. But i have specified the correct path
How to Read Excel file Using Java
How to Read Excel file In this section,you will learn how to read excel file... and every cell and stored the excel file values into the vector.This Vector data is then used to display file values on the console. Here is the code
splitting large xml file. - XML
splitting large xml file.  Hi, I have a large xml file(1G) and a schema (XSD) i need to split this xml to small xml files (~20M) that will be valid by the schema
how to upload a file of apk format in a folder from servlet
how to upload a file of apk format in a folder from servlet  How to upload a file of apk format to a folder from servlet, i am trying to do, its getting uploaded as .zip file and not apk file
How to export data from html file to excel sheet by using java
How to export data from html file to excel sheet by using java   reading the data from Html file
How to convert excel file int xml format in java
How to convert excel file int xml format in java  How to read excel file(xls) which is stored in any directory(D://) and convert it into xml format in java and place in any directory(E://).Can any body provide the code
How to Retrieve Data from the database and write into excel file using Java
How to Retrieve Data from the database and write into excel file using Java  Hi, I am trying to develop an small application where i trying to retrieve Data from the database and store the details in excel file. Please can
jsp upload file to server
jsp upload file to server  How to create and upload file to server in JSP?   Find the given example that explains how to upload single and multiple file on server using JSP
file upload
file upload  how to recieve the uploaded file on the next jsp page for modification if its uploaded to the previous page using a from
File Upload
File Upload  Hi I need script / string in PHP where I uploaded the file in html frontend and it should sent the uploaded file as attachment to my email address
How to upload zip file from android to server programmatically?????
How to upload zip file from android to server programmatically?????  hi , I want to upload zip file from android phone sdcard to server programmatically. So any one do this task in past so please share your experience with me
how do i upload a file by using servlet or jsp?
how do i upload a file by using servlet or jsp?  hi plz tell me the write java code

Ads