Java + MS Excel + MS Outlook

How can we use Java to access contents in an excel file and convert the info into a message and mail this through MS Outlook?
Plz reply to [email protected]

How can we use Java to access contents in an excel
file and convert the info into a message and mail
this through MS Outlook?You would want to look for Jakarta POI to read Excel sheets.

Similar Messages

  • Office 2013 Home & Business Edition - None of the application (Word, Powerpoint, Excel or Outlook) is opening, not even in safe mode..

    Office 2013 Home & Business Edition - None of the application (Word, Powerpoint, Excel or Outlook) is opening, not even in safe mode.. I tried to run the application in compatibility mode by right clicking the excel.exe and choosing the compatibility
    mode, still no success. It is installed on Windows 7 Professional SP1. All the latest updates are already installed. I have also tried Microsoft fixit, but still no Success. Please help!! 

    I'm so sorry that I forgot the Office programs even not open in safe mode and provide useless information in my last reply.
    The problem persists when we perform a Windows clean boot, right?
    Were the Office programs suddenly not working? Or it just can’t be open after you install it? Did you get any error message?
    If you haven’t try a repair of your Office installation, we can try it to check the result:
    http://office.microsoft.com/en-us/project-help/repair-office-programs-HA010357402.aspx
    In addition, try to use Event Viewer to see if we can get some useful error log about this problem. See:
    http://windows.microsoft.com/en-us/windows/open-event-viewer#1TC=windows-7
    Regards,
    Steve Fan
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please click
    here

  • Acrobat X Standard - Screen fonts changed/distorted in Word, Excel and Outlook

    Upon installation of Acrobat X, the screen fonts displayed in Word, Excel, and Outlook changed to a simple font in some cases and appear as a distortion in other cases.  I would like remedy this.  Any suggestions?

    Edit:
    The description above was erroneously written in german - sorry for that - please find the english description below:
    PC Windows 7 Pro
    Office 2010
    Acrobat X Standard
    I alrady tried to change the pre-adjustment in Acrobat X Standard for Word and Excel, that PDF files should be generated in PDF Version 1.4 out of these applications - but it did not work.

  • How to communicate from java to excel?

    I need to pass data from java to excel such that it'll create a report.
    It should be able to handle images also. ie.
    I have a form which contains some data.
    I need to read the data from the form and export the data - in the same format in the form - to MSexcel. I should be able to put the data in specific cells of MSexcel.
    Please help.

    example:
    out.print("Line1");
    out.print(",col2");
    out.print(",col3");
    out.println("");
    out.print("col1 - line2");
    ...

  • Removing adobe reader icon from excell and outlook

    How can I permanently remove the adobe reader V9 icon from Excel and Outlook? I used toolbar customize to delete the icons but they come back when I restart the programs.

    Sorry, your question is not clear.  Can you give us the exact wording (or a screenshot) of that notification?
    What is your operating system?

  • How to export message body and data from Table to Excel from outlook 2010

    I usually get Employee announcement in emails and I need to compile excel sheet from all these emails to know change in status of employee from previous line to current line .
    Dear Concerned,
    The change in status of the following employee has been carried out as per following details:
    New Status
    Change in Job
    Effective Date
    01-Feb-2015
    Employee Name
    Ricky ponting
    Employee Code
    4982
    Designation
    Sourcing Executive (Secondment)
    Job Group
    1A
    Department
    Sourcing & Supply Chain
    Unit
    Technology Sourcing
    Division
    Finance
    Location
    sydney
    Reporting Line
    Mr Micheal king
    Note: Ricky Ponting  was previously working as
    Tariff Implementation Support Officer XYZ organization was reporting to
    Mr Robin Sing
    I need working code that export about HTML table data as well last Note : full line so that I can have an excel file of 2000 Employees whoes status have been changed and I can easily sort out from which previous line they were reporting to new line and I
    can get in touch with the new line for any Access rights re-authorization exercise on later stage .
    Currently i am using following code thats working fine with the table extraction but NOTE: line is not being fetched with the following code based on following URL
    https://techniclee.wordpress.com/2011/10/29/exporting-outlook-messages-to-excel/
    Const MACRO_NAME = "Export Messages to Excel (Rev Sajjad)"
    Private Sub ExportMessagesToExcel()
        Dim olkFld As Outlook.MAPIFolder, _
            olkMsg As Outlook.MailItem, _
            excApp As Object, _
            excWkb As Object, _
            excWks As Object, _
            arrCel As Variant, _
            varCel As Variant, _
            lngRow As Long, _
            intPtr As Integer, _
            intVer As Integer
        Set olkFld = Session.PickFolder
        If TypeName(olkFld) = "Nothing" Then
            MsgBox "You did not select a folder.  Operation cancelled.", vbCritical + vbOKOnly, MACRO_NAME
        Else
            intVer = GetOutlookVersion()
            Set excApp = CreateObject("Excel.Application")
            Set excWkb = excApp.Workbooks.Add
            Set excWks = excWkb.Worksheets(1)
            excApp.Visible = True
            With excWks
                .Cells(1, 1) = "Subject"
                .Cells(1, 2) = "Received"
                .Cells(1, 3) = "Sender"
                .Cells(1, 4) = "New Status"
                .Cells(1, 5) = "Effective Date"
                .Cells(1, 6) = "Employee Name"
                .Cells(1, 7) = "Employee Code"
                .Cells(1, 8) = "Designation"
                .Cells(1, 9) = "Job Group"
                .Cells(1, 10) = "Department"
                .Cells(1, 11) = "Unit"
                .Cells(1, 12) = "Division"
                .Cells(1, 13) = "Location"
                .Cells(1, 14) = "Reporting Line"
                .Cells(1, 15) = "Note:"
            End With
            lngRow = 2
            For Each olkMsg In olkFld.Items
                excWks.Cells(lngRow, 1) = olkMsg.Subject
                excWks.Cells(lngRow, 2) = olkMsg.ReceivedTime
                excWks.Cells(lngRow, 3) = GetSMTPAddress(olkMsg, intVer)
               For intPtr = LBound(arrCel) To UBound(arrCel)
                    Select Case Trim(arrCel(intPtr))
                        Case "New Status"
                            excWks.Cells(lngRow, 4) = arrCel(intPtr + 1)
                        Case "Effective Date"
                            excWks.Cells(lngRow, 5) = arrCel(intPtr + 1)
                        Case "Employee Name"
                            excWks.Cells(lngRow, 6) = arrCel(intPtr + 1)
                        Case "Employee Code"
                            excWks.Cells(lngRow, 7) = arrCel(intPtr + 1)
                        Case "Designation"
                            excWks.Cells(lngRow, 8) = arrCel(intPtr + 1)
                        Case "Job Group"
                            excWks.Cells(lngRow, 9) = arrCel(intPtr + 1)
                        Case "Department"
                            excWks.Cells(lngRow, 10) = arrCel(intPtr + 1)
                        Case "Unit"
                            excWks.Cells(lngRow, 11) = arrCel(intPtr + 1)
                        Case "Division"
                            excWks.Cells(lngRow, 12) = arrCel(intPtr + 1)
                        Case "Location"
                            excWks.Cells(lngRow, 13) = arrCel(intPtr + 1)
                        Case "Reporting Line"
                            excWks.Cells(lngRow, 14) = arrCel(intPtr + 1)
                        Case "Note:"
                            excWks.Cells(lngRow, 14) = arrCel(intPtr + 1)
                        End Select
                Next
                lngRow = lngRow + 1
            Next
            excWks.Columns("A:W").AutoFit
            excApp.Visible = True
            Set excWks = Nothing
            Set excWkb = Nothing
            Set excApp = Nothing
        End If
        Set olkFld = Nothing
    End Sub
    Private Function GetSMTPAddress(Item As Outlook.MailItem, intOutlookVersion As Integer) As String
        Dim olkSnd As Outlook.AddressEntry, olkEnt As Object
        On Error Resume Next
        Select Case intOutlookVersion
            Case Is < 14
                If Item.SenderEmailType = "EX" Then
                    GetSMTPAddress = SMTP2007(Item)
                Else
                    GetSMTPAddress = Item.SenderEmailAddress
                End If
            Case Else
                Set olkSnd = Item.Sender
                If olkSnd.AddressEntryUserType = olExchangeUserAddressEntry Then
                    Set olkEnt = olkSnd.GetExchangeUser
                    GetSMTPAddress = olkEnt.PrimarySmtpAddress
                Else
                    GetSMTPAddress = Item.SenderEmailAddress
                End If
        End Select
        On Error GoTo 0
        Set olkPrp = Nothing
        Set olkSnd = Nothing
        Set olkEnt = Nothing
    End Function
    Function GetOutlookVersion() As Integer
        Dim arrVer As Variant
        arrVer = Split(Outlook.Version, ".")
        GetOutlookVersion = arrVer(0)
    End Function
    Function SMTP2007(olkMsg As Outlook.MailItem) As String
        Dim olkPA As Outlook.PropertyAccessor
        On Error Resume Next
        Set olkPA = olkMsg.PropertyAccessor
        SMTP2007 = olkPA.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x5D01001E")
        On Error GoTo 0
        Set olkPA = Nothing
    End Function
    Sub DebugLabels()
        Dim olkMsg As Outlook.MailItem, objFSO As Object, objFil As Object, strBuf As String, strPth As String, arrCel As Variant, intPtr As Integer
        strPth = Environ("USERPROFILE") & "\Documents\Debugging.txt"
        Set olkMsg = Application.ActiveExplorer.Selection(1)
        arrCel = Split(GetCells(olkMsg.HTMLBody), Chr(255))
        For intPtr = LBound(arrCel) To UBound(arrCel)
            strBuf = strBuf & StrZero(intPtr, 2) & vbTab & "*" & arrCel(intPtr) & "*" & vbCrLf
        Next
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set objFil = objFSO.CreateTextFile(strPth)
        objFil.Write strBuf
        objFil.Close
        Set olkMsg = Application.CreateItem(olMailItem)
        With olkMsg
            .Recipients.Add "[email protected]"
            .Subject = "Debugging Info"
            .BodyFormat = olFormatPlain
            .Body = "The debugging info for the selected message is attached.  Please click Send to send this message to David."
            .Attachments.Add strPth
            .Display
        End With
        Set olkMsg = Nothing
        Set objFSO = Nothing
        Set objFil = Nothing
    End Sub
    Function StrZero(varNumber, intLength)
        Dim intItemLength
        If IsNumeric(varNumber) Then
            intItemLength = Len(CStr(Int(varNumber)))
            If intItemLength < intLength Then
                StrZero = String(intLength - intItemLength, "0") & varNumber
            Else
                StrZero = varNumber
            End If
        Else
            StrZero = varNumber
        End If
    End Function

    Dear Graham
    I am already big fan of yours and using mail to many Addin from years from word 2007 to Word 2010 :) and still loving it and I use it for access re-authorization from Lines for application accesses . I tried and finally got understanding of the Extract to
    mail Addin and after tweaking excel - Text To columns and other few things finally i was able to get the required data - from morning to now :) I am happy to see your provided guidance
    Thanks alot - by the way why your Mail to many add-in is so slow now these days :) previous versions usually help me send 1000 emails in 10 minutes now it takes long time :)

  • SQL insert statement in java with Excel file

    Dear all,
    I wrote a program is as the follow:
    import java.io.*;
    import java.sql.*;
    public class handleExcel
         Connection con = null;
         Statement stmnt = null;
         public handleExcel()
              String excel = "C:\\EGS\\app_files\\info_update_form_exported_data.xls";
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   String str="jdbc:odbc:DRIVER=Microsoft Excel Driver (*.xls);DBQ=" + excel + ";";
         String sql = "insert into [Sheet1$] (Name, Age, Test1, Test2, Test3) values ('mary','16','aa','bb','vv')";
                   con = DriverManager.getConnection(str, "", "");
                   stmnt = con.createStatement();
                   stmnt.executeUpdate(sql);
              catch(Exception e)
                   System.out.println("con is error!!");
                   e.printStackTrace();
         public static void main(String[] args)
              handleExcel TestHpc = new handleExcel();
    But when I run it, the error is as the follow:
    java.sql.SQLException: [Microsoft][ODBC Excel Driver]
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
         at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3111)
         at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
         at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288)
         at hk.gov.edb.util.handleExcel.<init>(handleExcel.java:31)
         at hk.gov.edb.util.handleExcel.main(handleExcel.java:97)
    Please help me to solve this problem. Thank you so much for your help!
    Regards,
    kzyo

    Hi
    You can use the[b] jakarta POI api in order to read/write Excel file from java. Pure Java, no drivers nedeed.
    I tested and ok.
    Hope this helps

  • Writing data from Java to Excel

    Hi,
    I am trying to writhe data from Java to an Excel Sheet by using JACOB.
    This is my code :
    import java.util.*;
    import java.io.*;
    //import cost.util.*;
    import com.jacob.com.*;
    import com.jacob.activeX.*;
    class XLStock
         public static void main(String argv[])
              XLStock xls = new XLStock();
              xls.main2(argv);
         public void main2(String argv[])
              System.setSecurityManager(null);
              System.runFinalizersOnExit(true);
              Vector v = new Vector();
              XLSPutItem pi;
              String sheetfile = null;
              ActiveXComponent xl;
              Object xlo=null;
              Object workbooks;
              Object workbook;
              Object sheets;
              Variant vOptn = new Variant();
              vOptn.noParam();
              try
                   xl = new ActiveXComponent("Excel.Application");
                   xlo = xl.getObject();
                   Dispatch.put(xlo, "Visible", new Variant(true));
                   xl.setProperty("Visible", new Variant(true));
                   workbooks = xl.getProperty("Workbooks").toDispatch();
                   Variant vTemp = new Variant(argv[0]);
                   workbook = Dispatch.invoke(workbooks, "Open", Dispatch.Method,
                        new Variant[] {vTemp, vOptn, vOptn, vOptn, vOptn, vOptn, vOptn, vOptn, vOptn, vOptn, vOptn, vOptn, vOptn},
                        new int[1]).toDispatch();
                   sheets = Dispatch.get(workbook,"Sheets").toDispatch();
                   pi = new XLSPutItem();
                   if (pi.Parse("1:A1;ciao;6"))
                        v.addElement(pi);
                   for (int i=0; i<v.size(); i++)
                        pi = (XLSPutItem)v.elementAt(i);
                        pi.sheet = Dispatch.invoke(sheets, "Item", Dispatch.Get, new Object[] {new Variant(pi.sheetNumber)}, new int[1]).toDispatch();
                        pi.cell = Dispatch.invoke(pi.sheet, "Range", Dispatch.Get, new Object[] {pi.cellName}, new int[1]).toDispatch();
              catch (Exception e)
                   e.printStackTrace();
              pi = (XLSPutItem)v.firstElement();
              Dispatch.put(pi.cell, "Value", "ciao");
    What happen is that my code always fail at this line :
    xl = new ActiveXComponent("Excel.Application");
    whit this error :
    C:\VJWorks\JNI\jxls>java jxls.XLStock
    com.jacob.com.ComFailException: Can't co-create object
    at com.jacob.com.Dispatch.createInstance(Native Method)
    at com.jacob.com.Dispatch.<init>(Dispatch.java)
    at com.jacob.activeX.ActiveXComponent.<init>(ActiveXComponent.java)
    at jxls.XLStock.main2(XLStock.java:53)
    at jxls.XLStock.main(XLStock.java:28)
    Exception in thread "main" java.util.NoSuchElementException
    at java.util.Vector.firstElement(Vector.java:450)
    at jxls.XLStock.main2(XLStock.java:79)
    at jxls.XLStock.main(XLStock.java:28)
    I task that something is wrong in my system configuration.
    I work on a Win2000 platform and Office 97.
    Someone knows the reason of this error and can suggest what to make.
    Thanks in advance.
    Antonio M.

    Antonio, maybe you can post this back to the Jacob list. As an alternative to Jacob, what about Apache POI or writing the data as comma-delimited and opening the file using Runtime?
    Hope that may help.
    Good luck.

  • Java to Excel using JXLS

    hi,
    i am new to this forum... i am having an error in converstion to excel sheet.. i am using JXLS .. My sample program is here but i am getting a Class not found error..
    package jexceldemo;
    import java.io.*;
    import org.jxls.exception.ParsePropertyException;
    import org.jxls.transformer.XLSTransformer;
    import org.apache.commons.logging.LogFactory;
    import org.apache.commons.logging.impl.LogFactoryImpl;
    import org.apache.commons.logging.LogConfigurationException;
    import org.jxls.transformer.*;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    public class excel {
    public excel() {
    try {
    jbInit();
    } catch (Exception ex) {
    ex.printStackTrace();
    private static String templateFileName = "C:\\temp1\\grouping.xls";
    private static String destFileName = "C:\\temp1\\grouping_output.xls";
    private static Department mobjDepartment =null;
    public boolean addData(String pstrDepData, String[] pstrChiefData, String[][] palEmpData){
    boolean mblnResStatus=false;
    Employee mobjEmployees = null;
    Employee mobjChief=null;
    String name;
    int age;
    Double payment;
    Double bonus;
    try{
    mobjDepartment = new Department(pstrDepData);
    mobjChief=new Employee(pstrChiefData[0],Integer.parseInt(pstrChiefData[1]),Double.valueOf(pstrChiefData[2]),Double.valueOf(pstrChiefData[3]));
    mobjDepartment.setChief(mobjChief);
    System.out.println("Name\tAge\tPayment\tBonus");
    System.out.println("------------------------------");
    for(int inEmp=0;inEmp<palEmpData.length;inEmp++){
    name = palEmpData[inEmp][0].toString();
    age = Integer.parseInt(palEmpData[inEmp][1].toString());
    payment = Double.valueOf(palEmpData[inEmp][2].toString());
    bonus = Double.valueOf(palEmpData[inEmp][3].toString());
    mobjEmployees = new Employee(name, age, payment, bonus);
    mobjDepartment.addEmployee(mobjEmployees);
    System.out.println(name+"\t"+age+"\t"+payment+"\t"+bonus);
    System.out.println("------------------------------");
    catch(Exception mobjEx){
    System.out.println("Error"+mobjEx.getMessage());
    return mblnResStatus;
    public static void main(String[] args) throws IOException, ParsePropertyException {
    excel ex=new excel();
    if (args.length >= 2) {
    templateFileName = args[0];
    destFileName = args[1];
    String[] mstrobjChief={"Pravin","23","2500","1000"};
    String[][] mstrobjEmp=new String[5][4];
    for(int inEmpinfo=0;inEmpinfo<5;inEmpinfo++){
    mstrobjEmp[inEmpinfo][0]="Name"+inEmpinfo;
    mstrobjEmp[inEmpinfo][1]=""+inEmpinfo;
    mstrobjEmp[inEmpinfo][2]=""+inEmpinfo;
    mstrobjEmp[inEmpinfo][3]=""+inEmpinfo;
    ex.addData("IT",mstrobjChief,mstrobjEmp);
    Map beans = new HashMap();
    beans.put("departments", mobjDepartment);
    XLSTransformer transformer = new XLSTransformer();
    transformer.transformXLS(templateFileName, beans, destFileName);
    private void jbInit() throws Exception {
    The error i am getting is
    java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
         at org.jxls.transformer.XLSTransformer.<init>(XLSTransformer.java:30)
         at jexceldemo.excel.main(excel.java:93)
    Exception in thread "main"
    Eployee and Department are bean classes..

    Hi,
    I am trying StyleRowProcessor to apply some styles to particular cell. In JXLS examples, I did not get this lines.
    String styleCellLabel = "customRow";
    if( namedCells.containsKey( styleCellLabel ) ){
    Cell customCell = (Cell) namedCells.get( styleCellLabel );
    for (int i = 0; i < row.getCells().size(); i++) {
    Cell cell = (Cell) row.getCells().get(0);
    HSSFCell hssfCell = cell.getHssfCell();
    if( hssfCell!=null ){
    copyStyle( row.getSheet().getHssfWorkbook(), customCell.getHssfCell(), hssfCell );
    What is this customRow, From where do we pass or set this?

  • Extract data from Java to Excel

    Apologies for my ignorance in this field but is it possible to extract data from a Java based application (stock charts and the like) directly into Excel? If so could someone please contact me and explain the process in very simple terms as i have no idea how Java works :o)
    Many thanks.
    Gilsey

    Actually I should qualify my "Yes" answer. It is possible for a Java application to output data to Excel (using Jakarta POI for example). Whether it is possible to persuade an existing Java application to do that depends on the application. If it has been programmed to do it, then yes. Or if it has an underlying database where it stores its data, and you have access to that database, it might be possible to extract data from the database into Excel. Otherwise the programming of the application would have to be changed.

  • Help me in MS-Access-Java-MS-Excel combination

    i have to read a spreadsheet using Java & store in Access. my code is unable to do that,so modify the given java code for the above requirements. Don't import the spreadsheet directly from Excel to Access.
    // The Java Code.
    import java.sql.*;
    import java.io.*;
    class linkrec{
    public static void main(String args[]) throws IOException {
    for(int j=0;j<1;j++){
    InputStream f= new FileInputStream("D:\\Backup\\BACK UP OF SCADA\\avt\\csv.dat");
    int i;
    do{  i=f.read();
         if(i!= -1)
         System.out.print((char) i);
    }while(i!= -1); //End OF Do-While Loop.
    f.close();
    } //End Of For Loop
    class connect throws IOException {
    public void connect (int f){
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:dacc");
    Statement stmt = con.createStatement();
    //stmt.executeUpdate("insert into sheet2 values(10:10,48.20,01556,01129,00177,00400,04076,01668,01336,02830)");
    stmt.executeUpdate("insert into sheet2 values(f)");
    ResultSet rs = stmt.executeQuery("select * from sheet2");
    while(rs.next())
         double Mytime = rs.getDouble(1);
         double Gridfreq= rs.getDouble(2);
         int ntpc_gen = rs.getInt(3);
         int nlcii_gen = rs.getInt(4);
         int maps_gen = rs.getInt(5);
         int kaps_gen = rs.getInt(6);
         int ap_gen = rs.getInt(7);
         int kar_gen= rs.getInt(8);
         int ker_gen = rs.getInt(9);
         int tn_gen = rs.getInt(10);
         stmt.close();
         con.close();
         System.out.println("Records Successfully Inserted");
         }catch(Exception e)
         e.printStackTrace();
    // The spreadsheet of Excel.
    MYTIME,GRID_FREQ,NTPC_GEN,NLCII_GEN,MAPS_GEN,KAPS_GEN,AP_GEN,KAR_GEN,KER_GEN,TN_GEN,AP_DEM,KAR_DEM,KER_DEM,TN_DEM,PONDY_DEM,GOVA_DEM,AP_DWL,KER_DWL,TN_DWL,PDY_DWL,GOA_DWL,AP_SCH,KAR_SCH,KER_SCH,TN_SCH,PDY_SCH,GOVA_SCH,EAST_GZK_EXC,EAST_USIL_EXC,WEST_RDM_EXC,WEST_AMD_EXC
    2/8/01
    10:10,48.20,01556,01129,00177,00400,04076,01668,01336,02830,04834,02528,01671,04093,00106,00120,00757,00860,00335,01263,00106,00120,01042,00736,00378,00982,00154,00070,00474,00000,-0000,00000

    Here's how I would do it - since I don't know the datatypes of the columns in your access database I will assume that MY_TIME is a String value, GRID_FREQ is a Double and the rest are Integers. You can then modify the parsing as you wish if the datatypes are different.
    Connection conn = null;
    BufferedReader reader = null;
    try
      reader = new BufferedReader(new FileReader(filename));
      // First line contains names of columns so just skip that
      reader.readLine();
      StringBuffer sql = new StringBuffer();
      sql.append("INSERT INTO sheet2 (");
      sql.append("MY_TIME,");
      sql.append("GRID_FREQ,");
      // put the rest of the column names in here!
      sql.append(") VALUES (");
      // change this to have one '?' for each column
      sql.append("?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ..., ?");
      sql.append(")");
      conn = DriverManager.getConnection(...);
      PreparedStatement pstmt = conn.prepareStatement(sql.toString());
      // Read in the rest of the lines from the file - inserting a row for each
      String line;
      while(true)
        line = reader.readLine();
        st = new StringTokenizer(line, ",", false);
        // set up the statement for creating the new row
        pstmt.setString(1, st.nextToken());
        pstmt.setDouble(2, Double.parseDouble(st.nextToken()));
        pstmt.setInt(3, Integer.parseInt(st.nextToken()));
        // etc for all the other columns you need to read
        // create the row
        pstmt.executeUpdate();
    finally
      try
        reader.close();
      catch(Exception e)
      try
        conn.close();
      catch(Exception e)
    }I've not tried it so you might need to experiment to get it to work. If you don't understand any of it just ask.
    Hope this helps.

  • Linking java program to microsoft outlook

    how can i call outlook program from my java program??

    This question is one of the most frequenly asked questions.
    Search the forum from "Outlook" and you'll find plenty of replies.

  • Java with excel

    hi all,
    Is it possible to submit the values from an excel sheet to java
    Thanks in advance

    Another approach is to export the spreadsheet as "csv" (comma-separated-values).
    That you can read without a special package.

  • I recently downloaded Microsoft University 365 on my MacBook Pro and now every time I turn it on the Word, Excel and Outlook are open.  Any thoughts how to correct this?

    Can anyone give me advise on how to stop the Excel, Word and Outlook from my Microsoft Univeristy 365 from automatically opening each time I turn on my MacBookPro?

    Hi jau340,
    When you log off of your Mac, make sure that the box that says "Reopen windows when logging back in" is not checked:
    Cheers,
    GB

  • CSV from Java to Excel

    Hi all,
    Maybe you can help me? I am using the following line from a Java app
    LogWriter.write(TimerFmt.format(d)+ s +"," + p +"\n");
    to write to an Excel file - soon far so good.
    Do any body know how I can get TimerFmt.format(d) + s + p to print to separate columns.
    All assistance very much appreciated

    Hi PK
    I am sending in two String vars in the method
    log.writeLog(n,b);
    To a logger class
    class Logger
    private FileWriter fwrLogWriter;
    private File fleLogFile;
    The method that recieves them is
    public synchronized void writeLog(String s, String p, )throws IOException {
    Within this method I add a Timestamp and then write out to an Excel file with the method
    fwrLogWriter.write( s +',' + p +"\n");
    fwrLogWriter.flush();
    Do I need to put in some type separator in the .write()?
    Thanks
    DC

Maybe you are looking for

  • Why does my password keep resetting?

    I have reset my password 3 or four times in the last 24 hours. It keeps saying the password I generated last is incorrect. Little help?

  • BSEG table value can't apply formula

    I download amount column for BSEG into excel, for example, in excel, the document number 400000235 has amount 51.866,60, when I apply formula column X=1.5*amount column, it shows #value!, if I change to 51866.6, it works fine, I have more than 2000 l

  • Navigating page to page while "registering" pages one another

    Okay, this may sound a little weird, but bear with me. Lets assume we are navigating a two pages PDF. The pages are same size and nearly same content except for some small details. If one fit the page into the window (CTRL+0), then pressing "pg-Up" a

  • Computer will not recognise ipod and crashes computer

    Working on windows xp, I have reset the ipod but it will not come up on the side bar, therefore I cannot download music, instead it just turns off the computer. I am lost somebody please help!!!!!!!

  • Sound system and Video playback.

    Hello. Out of no where the sound system of my new iPad just went off. I can't here a thing. Not even during games or applications. Not even the keyboard clicks. Also I found out that i cannot watch videos online. While on YouTube the video buffers bu