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.

Re: appending from shell script to excel sheet

I use SmartXLS. It is not free, but the demo is. There is supposed to be a time limit on the demo, but I found that if you download it on one machine, and copy and paste the library over to another machine, the demo never runs out. This works because it bases its time from the downloaded machine, which when you move it, can no longer update the library. The creators dont mind me doing this because they told me that if I dont want to upgrade, just redownload the library when it times out. The documentation is not great. I've been getting support from the creaters via email despite them knowing I dont have a licensed version. They even provided me with an updated demo library with some bugs fixed. And I've made some powerful programs with their demo library, so I can help you out with any issues you have.

Like I said, the documentation isnt great, but feel free to message me regarding any confusion, I can help with just about any issue you may have.

To do something simple like inserting data into an Excel Sheet with SmartXLS, this is what you would do:

importcom.smartxls.WorkBook;publicclass ExcelTesting
{publicstaticvoid main(String[] args){try{//Create new WorkBook Object
WorkBook workBook =new WorkBook();//Set workBook sheet to get edited at the moment
workBook.setSheet(0);//Create Values to get Inserted into WorkBookString wordValue ="Insert Word";double numberValueD =3.5;int numberValueI =5;String formulaValue ="A2+A3";//Write wordValue to cell A1
workBook.setText(0,0,wordValue);//Write numberValueD to cell A2
workBook.setNumber(1,0,numberValueD);//Write numberValueI to cell A3
workBook.setNumber(2,0,numberValueI);//Write formulaValue to cell A4
workBook.setFormula(3,0,formulaValue);//Alternatively, you can use the generic setEntry method to set values. You cannot use this method to set formulas.//Write numberValueD with General Type into cell B1
workBook.setEntry(0,1,numberValueD+"");//Create the new Excel file and insert data
workBook.write("WriteBook.xls");//Or you can create a 2007 Excel file and insert the data://workBook.writeXLSX("WriteBook.xlsx");}catch(Exception e){System.out.println(e);}}}