Writting in MS Excel which containing no sheet

I am developing application for the taxation purpose . I have an excel workbook which is macro enabled , but there is not any worksheet . This is provided by Government of India for vat return etc . How can i write data in excel workbook without containing sheet name . I need urgent. Please help as soon as possible.
Download excel book to check : http://www.eultimateinc.com/xls/

Yes , it contains cell where we will fill by simple text without any formula. But it's not showing any sheet.It is micro enabled workbook.
I used code as
Following xls workbook provided by Government Of India for there taxation purposes
*[special xls file to use |http://www.eultimateinc.com/xls/PVAT-24.xls] http://www.eultimateinc.com/xls/PVAT-24.xls*
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
public class NewClass {
    public static Connection getConnection() throws Exception {
        String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
        String url = "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=PVAT-24.xls;"
                + "DriverID=22;READONLY=false";
        String username = "";
        String password = "";
        Class.forName(driver); // load JDBC-ODBC driver
        return DriverManager.getConnection(url, username, password);
    public static void main(String args[]) throws Exception {
        Connection conn = null;
        Statement stmt = null;
        conn = getConnection();
        stmt = conn.createStatement();
        String excelQuery = "insert into [Sheet1$] values('Abc inc.') ";
        stmt.executeUpdate(excelQuery);
        stmt.close();
        conn.close();
I got an error
Exception in thread "main" java.sql.SQLException: [Microsoft][ODBC Excel Driver] 'Sheet1$' is not a valid name.  Make sure that it does not include invalid characters or punctuation and that it is not too long.
        at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
        at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
        at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3110)
        at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
        at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288)
        at NewClass.main(NewClass.java:35)
Java Result: 1Please help to resolve this . Thanx.

Similar Messages

  • Which is a better option to write to an Excel file?

    Back from the crypt...
    I googled for APIs to write to an Excel file and I stumbled upon JExcelAPI and Jakarta POI. I am not sure which one to use; both are equally confusing.
    Could anyone tell me which I should opt for? I just want your opinion so that I can start reading the documentation straightaway. Reading docs for both would be rather a waste of time IMO.
    I am open to more suggestions.
    Thanks
    UW

    Great to find that someone makes use of Google!
    Personally, I find Jakarta POI better. It has a really HorribleSpreadSheetFormat called HSSF, which I find pretty good. And there's a quick guide to write simple code for starting off.
    BTW, I never tried JExcelAPI.
    x

  • Excel problem StarStarStarStarStar Written by MA from Dubai  i have problem in excel when i write Arabic or i receive any excel file contain Arabic word it come like letters it do not come like word my Microsoft office is 2011 what i can do

    excel problem
    i have problem in excel when i write Arabic or i receive any excel file contain Arabic word it come like letters   it do not come like word
    my Microsoft office is 2011
    what i can do

    MS Office for Mac does not really support Arabic.  But you may just have a font problem.  Disconnected letters means a Windows font is being used.  Change the font to a Mac font like Geeza Pro.
    For better Arabic support, try OpenOffice.

  • Import an excel file which contain resource data to P6

    Hii,
    I had a problem of importing an excel file into p6 which contain resource data to p6.
    I used the import option which is present in file-import i followed the instruction and at last while clicking the finish tab its showing the import was successful.
    But in the resource it is emplty unable to display a single resource.
    plz help me or is there any other procedure for it plz let me know.
    Best regards
    Himansu

    As the previous poster stated, you need to export using resource assignments not activities. The only changes that P6 will accept will be to information about activities (Description, duration, etc) if you choose activities. Choosing Resources will allow changes to information with resources and resources asignments will allow changes to information pertaining to the interaction of the activities and resources.

  • Excel attachment contains only 1st row of Internal Table.

    Hello,
    I have designed a Vendor Ledger report and want to send the same as an excel attachment. I have made use of function module SO_NEW_DOCUMENT_ATT_SEND_API1 wherein I pass the parameters.
    The program works perfectly fine as I am receiving email along with the excel attachment. Also, the excel attachment opens without any errors. Also, the alignment of columns and data is perfect.
    But the problem is if my internal table is having 10 rows, I get only the first row of  the internal table in the excel sheet.
    I also put a break point just before calling the function module to send email, I could see that the internal table which contains the attachment is having all 10 rows.
    I really don't know what's going wrong in this.
    Request you to please help.
    Regards,
    Danish.

    Hi,
    Hi this is my code. Also, one thing I found that if i remove the Report Name i.e. "Vendor Ledger" , I get more than 1 row in my excel sheet. I feel there is some problem with the document size attributes.
    * Header for exception report
      CONCATENATE 'CC' 'Vendor' 'Stat' 'Name' 'Doc.No' 'FY' 'DDate' 'PDate'
                  'AssNo.' 'Doc.Tp' 'G/L' 'LAmt' 'LCurr' 'DAmt'
                  'D/C' 'Cl.Doc' 'TaxCd' 'TaxAmt'
                  INTO it_attachment SEPARATED BY
                  cl_abap_char_utilities=>horizontal_tab.
      CONCATENATE cl_abap_char_utilities=>cr_lf it_attachment INTO it_attachment.
      APPEND it_attachment.
    * Split Internal table data using horizontal tab.
      CLEAR it_main.
      LOOP AT it_main.
        CLEAR: lc_amt, dc_amt, tax_amt.
        lc_amt = it_main-lc_amount.
        dc_amt = it_main-amt_doccur.
        tax_amt = it_main-w_tax_base.
        CONCATENATE it_main-comp_code
                    it_main-vendor
                    it_main-status
                    it_main-name1
                    it_main-doc_no
                    it_main-fisc_year
                    it_main-doc_date
                    it_main-pstng_date
                    it_main-alloc_nmbr
                    it_main-doc_type
                    it_main-sp_gl_ind
                    lc_amt
                    it_main-loc_currcy
                    dc_amt
                    it_main-db_cr_ind
                    it_main-clr_doc_no
                    it_main-w_tax_code
                    tax_amt
                INTO it_attachment SEPARATED BY
                cl_abap_char_utilities=>horizontal_tab.
        CONCATENATE cl_abap_char_utilities=>cr_lf it_attachment INTO it_attachment.
        APPEND it_attachment.
      ENDLOOP.
    * Create Mail Body and Attachment.
      psubject = 'Vendor Ledger'.
      lv_message = 'Dear Sir/Madam,'.
      APPEND lv_message TO it_message.
      lv_message = ' '.
      APPEND lv_message TO it_message.
      lv_message = 'Attachment contain Vendor Ledger for Testing.'.
      APPEND lv_message TO it_message.
      lv_message = ' '.
      APPEND lv_message TO it_message.
      lv_message = ' '.
      APPEND lv_message TO it_message.
      lv_message = 'This is a System Generated Mail. Please do not reply.'.
      APPEND lv_message TO it_message.
    **Perform for populating mail characteristic info
      CLEAR gd_doc_data.
    * Populate the subject/generic message attributes
      gd_doc_data-obj_langu = sy-langu.
      READ TABLE it_attachment INDEX w_cnt.
      gd_doc_data-doc_size = 1.
      gd_doc_data-obj_name  = 'Danish'. "'SAPRPT'.
      gd_doc_data-obj_descr = psubject.
      gd_doc_data-sensitivty = 'F'.
    * Describe the body of the message
      CLEAR it_packing_list.
      REFRESH it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES it_packing_list-body_num.
      it_packing_list-doc_size = it_packing_list-body_num * 255.
      it_packing_list-doc_type = 'RAW'.
      APPEND it_packing_list.
    **Describe the attachment info
      CLEAR it_packing_list.
      it_packing_list-transf_bin = 'X'.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 1.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_attachment LINES  it_packing_list-body_num.
      it_packing_list-doc_type = 'XLS'.
      it_packing_list-obj_name = 'File'.
      it_packing_list-obj_descr = 'File'.
      it_packing_list-doc_size = it_packing_list-body_num * 255.
      APPEND it_packing_list.
      REFRESH it_receivers.
      CLEAR it_receivers.
      it_receivers-receiver = 'Email Address'.
      it_receivers-rec_type = 'U'.
      it_receivers-com_type = 'INT'.
      APPEND it_receivers.
    **Function Module to send mail
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = gd_doc_data
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = it_packing_list
          contents_bin               = it_attachment
          contents_txt               = it_message
          receivers                  = it_receivers
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.
    Regards,
    Danish.

  • Excel download into a sheet-2by taking formula from another sheet.-1

    i hv an internal table itab.which contain 3 fields a,b,c.
    a,b are input parameters (int).c = ab.Now i hv to download the values of a,b,c into a excel sheet-2 by <b>taking the formula</b>(c = ab) <b>from another sheet-1</b>.and everytime the new vales of a,b,c should be appended ito the sheet2.
    can anybody tell me which fm i shoud use?? or some sample code will be grrr88.
    points will be rewarded.

    See if these blogs can help you ...
    /people/rich.heilman2/blog/2005/09/12/manipulate-excel-with-ole-abap
    /people/sap.user72/blog/2006/02/07/downloading-data-into-excel-with-format-options
    Not sure if you can do the calculations.
    Regards,
    Ravi

  • I need to display a Report which contain -- del QTY  and  INV QTY   in one

    Hi ALL,
    I need to display a Report which contain
    <b>Customer  , Material , Order No, Delivery No, Billing No , Order Qty , Dev Qty, Bill Qty , Invoiced Qty  and There Values  in One Line  .</b>
    How can I Display, When I am executing the report against the Delivery Number Bill Qty and Invoiced Qty is showing Hash ( # ).
    Do I need to right any Routines for this, if I am correct,  where I have to write that code and what is the code ,
    What are the Consolidation  routines ?????
    I am working on BI 7.
    Regards ,
    Shaik
    Message was edited by:
            shaik

    Frst check in backend, which all cubes have got data for each of three..
    Corresponding you can go ahead with Multi/Infoset..
    Look for reference no in all three cubes and pick one order and track tht by reference no in all cubes,
    Hope it helps..
    Thanks for points assigned

  • How Can we stop the execution of java program which contain infinite loop

    Dear All,
    I create one .bat file which which execute the simple java program
    I write one java program which execute above .bat file using instance of Runtime Class of java
    It's work fine if java program which is executed by .bat file is simple(Which has normal termination)
    But if that program contain inifinte loop then that file will goes on executing untill I close it manually
    So i want a solution in java which close that bat file (command window ) which is in running condtion
    If there any solution please replay me
    I try to close that .bat file using destroy() ,stop() method of Process and Runtime , Thread Class
    but it did not give me correct output
    .bat file still running !!!!!!!!!
    Thanks in advance

    Why not use javaw.exe to make the app run so you don't need the dos window (which is presumably what you are actually talking about when you say bat file).

  • How can i export the data to excel which has 2 tables with same number of columns & column names?

    Hi everyone, again landed up with a problem.
    After trying a lot to do it myself, finally decided to post here..
    I have created a form in form builder 6i, in which on clicking a button the data gets exported to excel sheet.
    It is working fine with a single table. The problem now is that i am unable to do the same with 2 tables.
    Because both the tables have same number of columns & column names.
    Below are 2 tables with column names:
    Table-1 (MONTHLY_PART_1)
    Table-2 (MONTHLY_PART_2)
    SL_NO
    SL_NO
    COMP
    COMP
    DUE_DATE
    DUE_DATE
    U-1
    U-1
    U-2
    U-2
    U-4
    U-4
    U-20
    U-20
    U-25
    U-25
    Since both the tables have same column names, I'm getting the following error :
    Error 402 at line 103, column 4
      alias required in SELECT list of cursor to avoid duplicate column names.
    So How can i export the data to excel which has 2 tables with same number of columns & column names?
    Should i paste the code? Should i post this query in 'SQL and PL/SQL' Forum?
    Help me with this please.
    Thank You.

    You'll have to *alias* your columns, not prefix it with the table names:
    $[CHE_TEST@asterix1_impl] r
      1  declare
      2    cursor cData is
      3      with data as (
      4        select 1 id, 'test1' val1, 'a' val2 from dual
      5        union all
      6        select 1 id, '1test' val1, 'b' val2 from dual
      7        union all
      8        select 2 id, 'test2' val1, 'a' val2 from dual
      9        union all
    10        select 2 id, '2test' val1, 'b' val2 from dual
    11      )
    12      select a.id, b.id, a.val1, b.val1, a.val2, b.val2
    13      from data a, data b
    14      where a.id = b.id
    15      and a.val2 = 'a'
    16      and b.val2 = 'b';
    17  begin
    18    for rData in cData loop
    19      null;
    20    end loop;
    21* end;
      for rData in cData loop
    ERROR at line 18:
    ORA-06550: line 18, column 3:
    PLS-00402: alias required in SELECT list of cursor to avoid duplicate column names
    ORA-06550: line 18, column 3:
    PL/SQL: Statement ignored
    $[CHE_TEST@asterix1_impl] r
      1  declare
      2    cursor cData is
      3      with data as (
      4        select 1 id, 'test1' val1, 'a' val2 from dual
      5        union all
      6        select 1 id, '1test' val1, 'b' val2 from dual
      7        union all
      8        select 2 id, 'test2' val1, 'a' val2 from dual
      9        union all
    10        select 2 id, '2test' val1, 'b' val2 from dual
    11      )
    12      select a.id a_id, b.id b_id, a.val1 a_val1, b.val1 b_val1, a.val2 a_val2, b.val2 b_val2
    13      from data a, data b
    14      where a.id = b.id
    15      and a.val2 = 'a'
    16      and b.val2 = 'b';
    17  begin
    18    for rData in cData loop
    19      null;
    20    end loop;
    21* end;
    PL/SQL procedure successfully completed.
    cheers

  • Add data to excel which is already in document library

    hi im new to sp2013,
    i need to add/fill data to the excel sheet-1 , i.e, which is already in the sharepoint document library and that too in sheet-1 only because, i had a macro on excel which is on doc lib, so i need to fetch data from list and to fill data to sheet-1 programatically
    or OOTB.
    thanks in advance

    The OOB way uses a data connection to retain link to a live SharePoint list.  You could possibly try exporting this data connection file (via the Data --> Data Connections dialog box) and importing that within your Report.XSLX
    If that's not sufficient, I imagine you'd need to create something with a VBA Macro.
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Need to generate the excel file with diffrent sheets using utl_file package

    Hi,
    Sorry for previous message in which I had missed the usage of " UTL_FILE " package
    I need to generate the excel file with diffrent sheets . Currently I am generating the data in three diffrent excel files using
    " UTL_File " package and my requirement is to generate this in a single excel file with diffrent sheets.
    Please help on this
    Thanks & Regards,
    Krishna Vyavahare

    Hello 10866107,
    at Re: How to save a query result and export it to, say excell? you can find links to different solutions. At least the packages behind second and fourth link support more than one worksheet.
    Regards
    Marcus

  • From sap to excel file with different sheets?

    can  i upload   an internal table  from  SAP to single Excel file with different sheets for example like : sheet1, sheet2, sheet3.......sheet10. , but need to upload data from sap to excel worksheets ie. from multiple named tabs in Excel. Is this possible, and if so, please can you help and advise me how?
    thanks
    venkat.
    Edited by: Matt on Feb 16, 2009 2:15 PM  Removed excessive question marks...!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    Hi venkat,
    Yes indeed it is possible to write data from internal table to different excel sheets. Check out SAP's Microsoft OLE functionality.Search on SDN for OLE . Following are some links
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/sample%252bprogram%252bto%252bopen%252bexcel%252bsheet%252busing%252bole
    You can also check out FM ALSM_EXCEL_TO_INTERNAL_TABLE to check how to read different worksheets.
    Using the above two resources you can create a program that can upload data to multiple worksheets in the same workbook.
    Also see this link
    Creating Excel with More than one page
    Edited by: aditya aghor on Feb 16, 2009 1:57 PM
    Edited by: aditya aghor on Feb 16, 2009 2:02 PM

  • How to read a line from a file which contains 45000 characters?

    Hi all,
         Iam a receiving a .CSV file which contains n number of rows ,each row has a data seperated with delimiter.
    These values based on delimiter it is seperated and certain validations are handled.
    Iam using UTL_FILE.GET_LINE operator to read the value and store it in a variable which is declared as l_text VARCHAR2(30000).
    when we receive a line which contains huge characters say 45000 then it throws an error(Unable to read the file).
    Only on rare cases we used to receive these kind of files with huge size.
    Kindly help to solve this issues.
    Database details.
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE 11.2.0.2.0 Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    Hereby i have tried with long Raw data type but still same error unable to read the file.pls find the sample code below,
    declare
    l_text             LONG RAW;
    l_importTypeFile   UTL_FILE.FILE_TYPE ;
    begin
         PKG_COMMON.PROC_FOPEN(g_Directory, P_FILENAME,    'RB',l_importTypeFile,    p_error_cd, p_error_msg) ;
    UTL_FILE.GET_RAW(l_ImportTypeFile,l_Text);
    End;
    Thanks in Advance
    Siva

    Hi Siva,
    Are you trying to use data from this .csv file into your realtion tables. If yes and If you are using 11g Oracle database. I would suggest you create External Tables using the below query,
    http://www.oracle.com/technetwork/issue-archive/2011/11-mar/o21nanda-312277.html
    STEP1: You need a Directory where your SCHEMA has read/write access. Store the csv file in that directory.
    STEP2: Create an EXTERNAL Table script. Please refer the above URL. Examples are for coma delimiter (,); replace it with your pipe (|) in the code
    STEP: Once your external table is created you can simply create a relational table as below:
    CREATE  TABLE relation_table
      AS
    SELECT * FROM external_table;
    Regards,
    RaviR

  • Write back from Excel into OBIEE?

    Hi Experts,
    I have a requirement, where in I have to write back into Oracle DB through OBIEE.
    The user will upload an excel/csv containing more than hundred records into OBIEE dashboard.
    The functionality is, on click of a (submit) button the OBIEE should write back into Oracle DB (through OBIEE) row by row taken from excel.
    Pls help if any one has any idea. I'm new to OBIEE tool.
    Have a great day!!!
    Thanks,
    Venky

    Why do you want to do that through OBIEE? It's not a data loading tool! The write-back functionality is explicitly built for sporadic updates and not for mass-import.
    From Booshelf:
    The write back feature is not suitable for entering arbitrary new records. In other words, do not
    use it as a data input tool.
    (Oracle Business Intelligence Presentation Services Administration Guide Version 10.1.3.2 - Configuring Report Write Back - Write Back Limitations)
    Use OWB, ODI, Informatica or any other ETL Tool for that (yes, I know ODI is ELT...don't start a flame war over that ;-)).
    Cheers,
    C.

  • Find the schema which contains all these tables

    In my DB, only SCOTT has all the three tables EMP,DEPT, BONUS. There are schemas which have either one or two of these tables but only SCOTT has all these 3 tables.
    To find the schema which contains all these *3* tables. I tried the below mentioned queries which gave the wrong answers.
    1.
    select TABLE_NAME, owner from dba_Tables where table_name IN ('EMP','DEPT', 'BONUS')-- will return any schema which has any of these tables. So, wrong result
    2.
    select TABLE_NAME, owner from dba_Tables where table_name = 'EMP' AND TABLE_NAME='DEPT' AND TABLE_NAME= 'BONUS'-- Wrong result because it is mutually contradictory. As AP has mentioned below, A table_name cannot be equal to all the three tables .
    Edited by: GarryB on Dec 22, 2010 7:56 AM

    Hi,
    GarryB wrote:
    Thanks everyone. So, this means that this seemingly simple query cannot be written with just a plain AND , OR . Right?You're right. Every query needs SELECT and FROM, for example.
    What's wrong with Solomon's simple solution?
    Whatever you don't like about it, I'm sure there's another approach that doesn't have the same problem, even if it is slower and more complicated.
    As AP pointed out, no one row has all the information you need to decide if that row will be part of the result set or not.
    You need something that can make a decision based on the data in multiple rows.
    GROUP BY, like Solomon suggested, is the easiest and most efficient way I know of.
    Anything that GROUP BY does can probably be done by analytic functions. In this case, it will be more complicated and slower, but you can get the same results.
    A self-join, as user13524665 demonstrated, is another way.
    You could also get the results you want using EXISTS-, IN-, or scalar sub-queries, all of which would be even more complicated, and scale just as poorly, as a self-join.
    CONNECT BY, recursive sub-queries, MODEL, and XML functions can also look at several rows at the same time. I don't believe you want to read and test soltuions for all of these any more than I want to write all of them. Solomon gave a good solution for your original problem. If you want to add some extra restrictions to your problem (such as "I can't use ... or ...") explain clearly what those restrictions are, and why you need them.

Maybe you are looking for