Skip to Content
author's profile photo Former Member
Former Member

values not getting inserted into excel sheet

The main purpose of the application that I am going to develop is

I created a form which consists of two input fields and a button using a tool by name NWDS which is made by adding some plugins to The ECLIPSE tool

Once the user enters the data in the input fields and clicks on the button the data must get inserted in the EXCEL sheet which is stored on my desktop


Name: empdetails.xls

Fields : EmpID ,EmpName

Java code which I have written is

Here ACTION1 is the action created for the button

Here first I fetch the data in the inputfields using getEMPID() and getEMPNAME()

Then I tried to create a connection to access the excel sheet

Then wrote the insert query.

How I got the ExcelJDBCTest?

Click start-àSettingsàControlPanel

Double click on ODBC

Click on SystemDSN.

Click Add

In the installed ODBC Drivers list select MICROSOFT EXCEL DRIVER

Clik Ok

In the Data Source Name field spreadsheet alias (ExcelJDBCTest)

Click on Select Workbook

Select the Path and filename (empdetails.xls)

Click on OK

Click on Ok in the ODBC MicrosoftExcel setup window

Click close

public void onActionACTION1( wdEvent )


//@@begin onActionACTION1(ServerEvent)

String eid = wdThis.wdGetContext().currentContextElement().getEMPID();

String ename = wdThis.wdGetContext().currentContextElement().getEMPNAME();

try {


Connection con = DriverManager.getConnection("jdbc:odbc:ExcelJDBCTest");

String sqlstmt = "INSERT INTO values(?,?)";

PreparedStatement stmt = con.prepareStatement(sqlstmt);


stmt.setString(2, ename);


} catch (ClassNotFoundException e) {

// TODO Auto-generated catch block


} catch (SQLException e) {

// TODO Auto-generated catch block



Once I execute the above code I do not see the values getting inserted into the excel sheet

Thanks in advance

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2008 at 06:52 AM


    As you are using jdbc-odbc bridge


    Connection con = DriverManager.getConnection("jdbc:odbc:ExcelJDBCTest");

    Your DataSourceName "ExcelJDBCTest" should exists on the server where the webdypro app is deployed.



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member


      Could you please provide me the steps how to create a DSN On the server....

      I do have all rights to access the server

      Forgot to tell you Microsoft excel and EP server are installed on the same machine

      Thanks in advance

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.