• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exporting information to MS excel

 
luc comeau
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, i havn't put a whole lot of thought to wheter or not this will work, but it would be nice if i could export some formatted data to an excel spreadsheet:A- that exists(append), b-or create.

I am generating alot of statistical data while running the tests for my program, and would just like to be able to use the features of excel to help me analyse it.

So if anyone has any ideas for me, the dicussion on this would be awesome.For all i know it could be as simple as putting the info out to a text file with an excel spreadsheet file extension, but im no expert on that,thats what you guy can help me with !thanks so much

-Luc
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
POI: http://jakarta.apache.org/poi/index.html
As it says on that page: In short, you can read and write MS Excel files using Java.

On an even simpler note, what about outputting a comma-separated file? Can't excel import that?
 
payal agrawal
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the URL below:

How to create an Excel file
http://www.java-tips.org/content/view/412/29/
 
luc comeau
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I took a look at that POI page, in theory seems like that would probably be the best solution...maybe.But the reality of the situation is i have to submit a paper based on these results to the ICEC confrence by Feb 20th, so it doesnt leave me much time to go learn how to use the api.

I am intrested in this comma separated text file solution, thats more along the lines i was considering.But i have no idea about the details on this.Perhaps its just as easy as separating every item in a column by a comma, then making a new row by a semi colon or something liek that.Is anyone more familar with this sort of thing?

thanks
 
Joe Ess
Bartender
Pie
Posts: 9266
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Excel can read CSV. In the simplest case, columns are seperated by commas and rows are simply new lines. It can get ugly if you have data that contains special characters. Have a look at this class and see if it meets your requirements.
 
luc comeau
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so has anyone ever installed the the jxl api before? on windows specifically?
It did not come with instructions as where to put the extracted files and i couldnt find any help when i google'd it
-Luc
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15219
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Luc, the website where you probably got the JXL API from contains a tutorial.

I just downloaded it myself and I see that the tutorial and Javadoc documentation is included in the package.

The thing you download from the download page is a *.tar.gz file. You have to unzip that using Winzip or another program that can unzip it.

Lik with any other Java API, you just have to put the JAR file (jxl.jar in this case) in your classpath. If you don't know what classpath is and how to set it, read this: How Classes are Found
[ February 03, 2006: Message edited by: Jesper de Jong ]
 
luc comeau
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dropped the jxl.jar file in the jre/ext folder and (using emacs) the program will compile until i start adding the classes in to actually use some of the api.
So this is where i fiured i had to change the classpath, but this is new territory for me and i read some of the tutorials on setting it but the only thing im scared of is setting it to the path where these new classes are, will it erase the path for loading all the other classes in?
On the tutorial it said this:
C:> sdkTool -classpath classpath1;classpath2...

-or-

C:> set CLASSPATH=classpath1;classpath2...

where:

sdkTool
A command-line tool, such as java, javac, javadoc, or apt

"
--this kinda scares me some..unless classpath variable is specifically for adding new class paths ..NOT overwriting them. Can i get some more adivce on this before i go screwring around with it ..thanks much.

more specifically, i still want to be able to load classes from my current directory that i have created...as well as these new jxl classes...as well as all the other java classes that would normally be able to be found..i just want to make sure that setting this classpath variable will not make it look STRICTLY in that path for classes.

also note that when you extract that file, inside the jexcelapi folder there is a file named
.classpath
with contains
"<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path=""/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="E:/usr/local/woodstock/jexcelapi/2_4_3/jxl.jar"/>
<classpathentry kind="output" path=""/>
</classpath>
"
that E:/usr/local/woodstock... path does not even exist on my machine. im confused what they want me to do with this.

[ February 03, 2006: Message edited by: luc comeau ]
[ February 03, 2006: Message edited by: luc comeau ]
 
luc comeau
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UPDATE:

The reason it was not recognizing my the new api classes, was something to do with the way emacs chooses the classpath variable for sessions. I have figuredthat out and things are good to go now. Although i may revive this thread when i have some questions about the xcel work itself with java.thanks again
Luc
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic