Read&write Excel file using java
Hi everybody,
I have an assignment about methods that read and write an excel file using java (Eclipse SDK), so if anyone know about that please post the solution as soon as possible.
Thanks
Sendbad
http://onesearch.sun.com/search/onesearch/index.jsp?qt=read+write+excel&subCat=siteforumid%3Ajava31&site=dev&dftab=siteforumid%3Ajava31&chooseCat=javaall&col=developer-forums
Similar Messages
-
Read / Write Excel file using package dbms_util and util_files
hi,
i am beginner to this so please elaborate the answer more conciselythere's a ton of reading on this subject on google my friend.
http://www.google.co.uk/search?hl=en&source=hp&biw=954&bih=517&q=plsql+read+write+excel&btnG=Google+Search&aq=f&aqi=&aql=&oq=plsql+read+write+excel
and check the forum faq, there's a topic on excel in here:
SQL and PL/SQL FAQ
Edited by: smon on Mar 2, 2011 3:39 AM -
Read an excel file using java code
Hi,
I want to create an excel file on the client machine based on the personal details entered on the web page. And I want to save the file on the client machine in the form of CSV. Then I want to read the contents of the spreadsheet using Java Code from the using servlets. Can I read the contents of the file directly from the client machine or do i need to save the file on the server and then read the contents of it. Please help me solve this.Hi,
I want to create an excel file on the client machine
based on the personal details entered on the web
page. And I want to save the file on the client
machine in the form of CSV. Then I want to read the
contents of the spreadsheet using Java Code from the
using servlets. Can I read the contents of the file
directly from the client machine or do i need to save
the file on the server and then read the contents of
it. Please help me solve this.As stated I am rather certain that is impossible.
Servers don't access the file systems of client machines. -
Possible to read/ write word files using Java?
I'm planning to write a Java application that can read an MS word document, extract something (including mathematics equations created with the equation editor) from the document and write it to another word document.
Is it possible to do this?
Can anyone give me some idea?
Any idea is much appreciated :)I think I may have misunderstood your question, but in case I didn't and you find this helpful, following is the code to read a word doc, replace certain strings, then write it out as a new doc.
import java.io.*;
public class Copy {
public static String endResult;
public static void main(String[] args) {
String oldAuthor = "Samuel Foote";
String newAuthor = "New Author";
String oldDate = "1720-1777";
String newDate = "1975 -- ";
try {
File inputFile = new File("C:\\document.doc");
BufferedReader input = null;
input = new BufferedReader(new FileReader(inputFile));
StringBuffer contents = new StringBuffer();
String line = null;
while ((line = input.readLine()) != null){
contents.append(line);
contents.append(System.getProperty("line.separator"));
String text = contents.toString();
// Replace the author and the dates
Copy y = new Copy();
y.replace(text, oldAuthor, newAuthor);
text = endResult;
y.replace(text, oldDate, newDate);
// Copy the new, improved text to another file //
Copy z = new Copy();
z.finalReplace(text);
input.close();
catch (FileNotFoundException ex) {
ex.printStackTrace();
catch (IOException ex){
ex.printStackTrace();
String replace(String text, String oldSubstring, String newSubstring) {
// Search the text for a string, then replace it //
int fromIndex = 0;
int e = 0;
StringBuffer sb = new StringBuffer();
while ((e = text.indexOf(oldSubstring, fromIndex)) >= 0) {
sb.append(text.substring(fromIndex, e));
sb.append(newSubstring);
fromIndex = e + oldSubstring.length();
sb.append(text.substring(fromIndex));
endResult = sb.toString();
System.out.println("final string = " + sb);
return sb.toString();
String finalReplace (String args) throws IOException {
// Move the altered text to a new file //
File outputFile = new File("C:\\copied document.doc");
FileWriter out = new FileWriter(outputFile);
Writer output = null;
try {
output = new BufferedWriter(new FileWriter(outputFile));
output.write(endResult);
finally {
if (output != null) output.close();
return endResult; -
How to read/write Excel sheets using java
Hello,
I have downloaded poi-2.5.1-all-bin and it has
poi-2.5.1-final-20040804 , poi-contrib-2.5.1-final-20040804, poi-scratchpad-2.5.1-final-20040804 jar Files
i am unable to configure POI which i have downloaded, when i do
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
it gives error while compilation saying cannot find Sheet class, Workbook class
should i use ant to build it or which jar file path should i specify in the classpath, because i have downloaded the POI package on to my desktop and included the specified the entire path of all the jar files in the classpath but still the same problem.
Please guide me.dvrsandeep wrote:
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
it gives error while compilation saying cannot find Sheet class, Workbook class
Either it isn't in your class path or you are using the wrong names. Simple as that.
Just as a possibility since you didn't import a "Sheet" class but rather a "HSSFSheet" that certainly suggests something is wrong. -
How to Write data in Excel File using java
Hi
can anybody help me to write data in excel file
using java code
Thankx In AdvanceHow much are you willing to pay for that?
If you want it for free, http://jexcelapi.sourceforge.net/ -
How to format a excel file use java.
hi,
everyone, i meet a problem.i want to write a excel file use java.i can use .csv input the date to excel.but i want to know how to format it.
thanks
Jovehi,
everyone, i meet a problem.i want to write a excel
el file use java.i can use .csv input the date to
excel.but i want to know how to format it.
thanks
JoveIf I understand your question correctly you need to know the format of a .csv file for use in an Excel spreadsheet. A .csv file is a comma-delimited file so all that you need to do is write your data elements to the file with commas in between them. Having done something similar in the past, let me warn you that when Excel is reading your file, it uses some characters other than commas as field delimiters. for example, / : and ; are treated as commas. To defeat this, you will need to surround fields containing those characters in double quotes.
Hope that helps
Mark -
Generate Excel File using Java
Hi,
could any one tell me how can I create an Excel file using java. I can create the file using PrintWriter and other IO classes. But how do I insert the data in to different cells and rows.
Any help would be greatly appreciated. Thanks in advance for your help,
-MSDear All,
There are three ways for achiving excel operations using java including excel to xml etc.
1. There is a very effective tool available for this operation is "jexcel". You can find it at http://www.andykhan.com/jexcelapi/index.html
2. Jakarta site has provided a very good tool by name jakarta poifs. one can find at jakarta site.
3. One can develop a very effective tool by combining these above tools togather.
The operations that can be performed are read, write, convert etc for excel. The major attraction of Jexcel is excel to xml conversion.
Regards,
Nishant Kulkarni
Software Engineer
[email protected] -
Read a excel file using swings
Does anyone know about reading an excel file using swings?
Right now, I am using com.f1j.ss.*. But looking for more examples like reading and writing a excel file.
Please suggest me with some good examples?1- Swing allows you to design a graphical user interface (to display data from a db or excel file for example)
2- [Here |http://www.rgagnon.com/javadetails/java-0516.html] several ways to read/write excel. -
How do I produce an excel file using java code
How do i produce an excel file using java code.
If it is possible would ne one have ne source code as an example.
I have tried looking up information on outputing the information to a *.csv file but unfortunality i have had no luck in finding any information. To be exact ne source code.
Thanks
LeeThat's what I use and I'd be the first to admit that it's very messy. But it works. Go use Google and see what else you can find.
-
Read an excel file using JSP in MII 12.1
Hi,
I want to read an excel file using jsp page. I dont want to use the UDS or ODBC for connecting to excel.
I am trying to use org.apache.poi to read the excel file in jsp page.
While running, its showing a compilation error "package org.apache.poi.hssf.usermodel does not exist"
I have the jar files for it, where do we need to upload it so that jsp page works.
Thanks a lot
Regards,
Neha MaheshwariThe user doesn't want to save the excel file in server.
I want to upload file and save its contents in database.
I have the code to read and save excel data in database but not able to get the location to deploy the jar file.
In general, if we are creating a jsp page in MII workbench which is using some jar file.
Whats the location to upload this jar file so that the jsp page works correctly? -
How to read a text file using Java
Guys,
Good day!
Please help me how to read a text file using Java and create/convert that text file into XML.
Thanks and God Bless.
Regards,
I-Talkpublic void fileRead(){
File aFile =new File("myFile.txt");
BufferedReader input = null;
try {
input = new BufferedReader( new FileReader(aFile) );
String line = null;
while (( line = input.readLine()) != null){
catch (FileNotFoundException ex) {
ex.printStackTrace();
catch (IOException ex){
ex.printStackTrace();
}This code is to read a text file. But there is no such thing that will convert your text file to xml file. You have to have a defined XML format. Then you can read your data from text files and insert them inside your xml text. Or you may like to read xml tags from text files and insert your own data. The file format of .txt and .xml is far too different.
cheers
Mohammed Jubaer Arif. -
Reading/writing PDF files using JAVA
how to read/write a PDF file using java,
while i read a pdf file using BUfferedReader class it gives a list of char. which is not readable.
how to convert those files to readable format.?
is there any special class for doin that.?
plz explain..?is there any special class for doin that.?Yes, I'm sure Google knows a few libraries that ca do that.
-
How to read the excel file using webdynpro abap?
Hi,
how to read and modify excel file using webdynpro abap?
Regards,
PavaniFor reading excel file follow the steps :
1. Use a File upload UI element and bind it with xstring.
2. Now your excel will be uploaded and stored in Xstring.
3. Convert Xstring to String data using FM 'HR_KR_XSTRING_TO_STRING'.
4. Now split the string at new line so as to make an internal table .
Ex . SPLIT l_string AT cl_abap_char_utilities=>newline INTO TABLE it_table.
here it_table is type table of string.
5.now loop at the internal table and separate the content of this table separated by tab.
Ex. SPLIT wa_table AT cl_abap_char_utilities=>horizontal_tab INTO TABLE it_new.
it_new type string_table.
6. For more info , refer this thread :
Re: How to upload excel file in Webdynpro application using ABAP -
How to read data from the excel file using java code.
Hi to all,
I am using below code to getting the data from the excel file but I can't get the corresponding data from the specific file. can anyone give me the correct code to do that... I will waiting for your usefull reply......
advance thanks....
import java.io.*;
import java.sql.*;
public class sample{
public static void main(String[] args){
Connection connection = null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection( "jdbc:odbc:Mydsn","","" );
Statement st = con.createStatement();
ResultSet rs = st.executeQuery( "Select * from [Sheet1$]" );
System.out.println("sample:"+rs);
ResultSetMetaData rsmd = rs.getMetaData();
System.out.println("samplersd:"+rsmd);
int numberOfColumns = rsmd.getColumnCount();
System.out.println("numberOfColumns:"+numberOfColumns);
while (rs.next()) {
System.out.println("sample1:"+rs);
for (int i = 1; i <= numberOfColumns; i++) {
if (i > 1) System.out.print(", ");
String columnValue = rs.getString(i);
System.out.print(columnValue);
System.out.println("");
st.close();
con.close();
} catch(Exception ex) {
System.err.print("Exception: ");
System.err.println(ex.getMessage());
}1: What is the name of the excel sheet?
2: What is printed in this program? null ? anything?
error?Excel file name is "sample.xls" I set excel file connectivity in my JDBC driver(DSN). Here in my program I am not giving that excel file name. I am giving only that excel sheet name. that is followed
ResultSet rs = st.executeQuery( "Select * from [Sheet1$]" );The output of this program is given bellow.
sample:sun.jdbc.odbc.JdbcOdbcResultSet@1b67f74
samplersd:sun.jdbc.odbc.JdbcOdbcResultSetMetaData@530daa
numberOfColumns:2
Maybe you are looking for
-
IMac way too slow at home, but works perfectly at Genius bar - why?
My iMac is slow when doing things like switching users, waking up from screen saver and switching and/or opening applications. Sometimes the spinning wheel of love will spin for 30 seconds (seems like an hour). I've got a memory monitor and I can see
-
when i pwr up my macbook, its nonresponsive and a box pops up that says the finder quit unexpectedly
-
I am very new to Swing....I am very confused about how event handling works. I created a button called "remove" and a list. When a user selects an item in the list and then clicks on the remove button, then the item should be deleted from the list. I
-
SAP 4.7 Installation error in RFC Logon
Hi friends, I tried installing 4.7 with Oracle. But in Final stage ie., while in RFC jobs it asks for RFC Logon verification as Username : DDIC Password: Any body could give solution for this prob. Thanks in Advance, Sridhar S
-
Conectivity between existent SAP Systems and migrated system to MSCS Cluste
Hi I have an existing SAP NW PI 7.0 (Abap + Java on Windows 2003 - SQLServer 2005) and plan to migrate to a cluster with new hardware (MSCS). I have to prepare for the installation by creating a homogeneous copy of the database but I'm a little bit c