Dear All,
I am new to java.
I have a requirement in a my project as I need to add the data from a shell script to a excel sheet every day in a new row.
I found this we can do by using java.
Help me in this regard..
Thanks in advance.
Printable View
Dear All,
I am new to java.
I have a requirement in a my project as I need to add the data from a shell script to a excel sheet every day in a new row.
I found this we can do by using java.
Help me in this regard..
Thanks in advance.
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:
Code java:
import com.smartxls.WorkBook; public class ExcelTesting { public static void 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 WorkBook String 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); } } }
Once you learn how to use the Library, it is EXTREMELY simple to use.