?
Solved

to read and write to excel from java code not working

Posted on 2008-10-19
1
Medium Priority
?
819 Views
Last Modified: 2013-11-23
In this prg if i write it is not writing it is blank  also please tell me hoe to read write a bunch of data
import java.io.File;
import java.io.IOException;
import java.util.Date;
import jxl.*;
import jxl.read.biff.BiffException;
import jxl.write.*;
import jxl.write.Number;
import jxl.write.biff.RowsExceededException;




 

public class RwExcel {

      /**
       * @param args
       */
      /**
       * @param args
       * @throws IOException
       * @throws BiffException
       * @throws WriteException
       * @throws RowsExceededException
       */
      public static void main(String[] args) throws BiffException, IOException, RowsExceededException, WriteException {
            
                  Workbook workbook = Workbook.getWorkbook(new File("test.xls"));
                  Sheet sheet = workbook.getSheet(0);
                  Cell a1 = sheet.getCell(0,0);
                  Cell b2 = sheet.getCell(1,1);
                  Cell c2 = sheet.getCell(2,1);

                  String stringa1 = a1.getContents();
                  String stringb2 = b2.getContents();
                  String stringc2 = c2.getContents();
            
                  System.out.println("Hai  "+ stringa1 +" " + stringb2);
            /*WritableWorkbook workbook = Workbook.createWorkbook(new File("output.xls"));

                  WritableSheet sheet = workbook.createSheet("First Sheet", 0);
                  Label label = new Label(0, 2,  "A label record");
                  
                  sheet.addCell(label);
                  

                  Number number = new Number(3, 4, 3.1459);
                  sheet.addCell(number); */

            

      }

}
0
Comment
Question by:cakurien
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 6

Accepted Solution

by:
wwnosal earned 1000 total points
ID: 22751693
I don't know this jxl software but I'm using poi to write and read Excel files. You have a link here
http://poi.apache.org/
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month11 days, 5 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question