Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: JExcelAPI

  1. #1
    Junior Member
    Join Date
    May 2011
    Posts
    16
    My Mood
    Depressed
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default JExcelAPI

    Hi there,

    I'm doing a Java application that allows users to input the range (eg. A1:B3) of the excel sheet they wish to get the data from. Then the program will read the content and output it. I'm using JExcelAPI and Eclipse.

    I'm having problem with the ranges as there is not examples or tutorials on ranges.

    Thankyou.


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: JExcelAPI

    I have only used Apache POI briefly a few years ago but not familiar with JExcel. However I think there is no way to extract the data from the specified range. What you would have to do is retrieve the desired rows and then the desired cells within those rows. But I could be wrong.

  3. #3
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: JExcelAPI

    I used JExcel long ago. I now use SmartXLS. If you can ignore the fact that you have to either purchase it or redownload the trial every 60 days, I would suggest going to that since you'll have MUCH more capability with Excel.

    Keep in mind that with JExcel, Ranges are not things like: A1:B3. Ranges are named ranges in Excel (opposed to just a range of cells). So if you're using the Range class, that is not what I think you are trying to do.

    My suggestion would be to call the Sheet's getCell() method and get each individual cell in the range.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  4. #4
    Junior Member
    Join Date
    May 2011
    Posts
    16
    My Mood
    Depressed
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: JExcelAPI

    Quote Originally Posted by Junky View Post
    I have only used Apache POI briefly a few years ago but not familiar with JExcel. However I think there is no way to extract the data from the specified range. What you would have to do is retrieve the desired rows and then the desired cells within those rows. But I could be wrong.
    Thanks for the reply. Is it possible to give me an example using Apache POI?

  5. #5
    Junior Member
    Join Date
    May 2011
    Posts
    16
    My Mood
    Depressed
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: JExcelAPI

    Quote Originally Posted by aussiemcgr View Post
    I used JExcel long ago. I now use SmartXLS. If you can ignore the fact that you have to either purchase it or redownload the trial every 60 days, I would suggest going to that since you'll have MUCH more capability with Excel.

    Keep in mind that with JExcel, Ranges are not things like: A1:B3. Ranges are named ranges in Excel (opposed to just a range of cells). So if you're using the Range class, that is not what I think you are trying to do.

    My suggestion would be to call the Sheet's getCell() method and get each individual cell in the range.
    So by using Sheet's getCell(), I'd be able to get the data values of the cells right?

  6. #6
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: JExcelAPI

    Quote Originally Posted by esplanade56 View Post
    So by using Sheet's getCell(), I'd be able to get the data values of the cells right?
    Well, if I am correct (which I'm not 100% sure I am):
    You call the Sheet's getCell() method. You can send this method either 2 ints (column and row) or a String representation of the desired cell (ex: A5). This method will then return a Cell Object. You then invoke Cell.getContents() method and it will return a String representing what is in the cell.

    To get a range of cell data (such as A1:B3), I would create my own method that goes through all the cells in that range, gets the data and stores it in a 2d array, and then returns the 2d array. It seems dumb that isn't already a method in the library, but whatever.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

Similar Threads

  1. how to copy cells to a new sheet of excel with JexcelAPI??
    By 19world in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: June 15th, 2010, 03:49 AM