How to read an excel file into the datatable in sdk code( AddonApplication)

Hi Experts,
Please let me know the code ,how to write an excel file to the datatable and based on the datatable it should write to the database table.
help would be appreciated...
Regards,
Vijay Kumar
Edited by: Haroon Rasheed on Oct 29, 2011 10:40 PM

Hi,
You may check: Read Excel File by Sheet then put it in Matrix
Thanks,
Gordon

Similar Messages

  • How to read a gif file into the java file?

    i want to read an image(*.gif) file into my appication. can u plz help me in this?

    Hi
    I have made a program that display images here is the code i hope it helps
    package ImageProcessing;
    import java.awt.Image;
    import java.awt.image.ImageObserver;
    import java.awt.image.RenderedImage;
    import java.io.File;
    import java.io.IOException;
    import javax.imageio.ImageIO;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    public class ImageProcessing
         public static Image imRead(String imagePath)
              Image im = null;
              try
                   File imageFile = new File(imagePath);
                   im = ImageIO.read(imageFile);
              catch(Exception e)
                   e.printStackTrace();
              return im;
         public void imWrite(Image im,String fileFormat,String imagePath) throws IOException
              File outputFile = new File(imagePath);
              ImageIO.write((RenderedImage) im, fileFormat, outputFile);
         public static void imShow(String imagePath)
              ImageObserver io = null;          
              JFrame frame = new JFrame();
              Image im = imRead(imagePath);
              ShowImage imShow = new ShowImage(im);
              frame.add(imShow);          
              frame.setVisible(true);
              frame.setTitle(imagePath);
              frame.setSize(im.getWidth(io),im.getHeight(io));
              frame.setResizable(false);
              frame.show();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public static void main(String[] args) throws IOException
              imShow("D:\\My Computer\\Images\\Cash2.gif");          
    package ImageProcessing;
    import java.awt.Graphics;
    import java.awt.Image;
    import java.awt.Panel;
    public class ShowImage extends Panel
           Image im;
           public ShowImage(Image inputIm)
             im = inputIm;
           public void paint(Graphics g)
             g.drawImage(im, 0, 0, null);
    }

  • How to read a CSV file into the portal

    hi all,
    I want to read the content of CSV file that is avaliable in my desktop.
    plz help me with suitable code
    Regards
    Savitha
    Edited by: Savitha S R on Jun 1, 2009 8:25 AM

    Please use this code for that
    REPORT  znkp_upload_csv line-size 400.
    DATA : v_filename TYPE string.
    PARAMETER : p_file LIKE rlgrap-filename DEFAULT 'C:\Documents and Settings\Administrator\Desktop\JV.csv' .
    *Types for Reading CSV file
    TYPES : BEGIN OF x_csv,
              text(400) TYPE c,
            END OF x_csv.
    *Global internal table for reading CSV file
    DATA : lt_csv TYPE TABLE OF x_csv.
    *Global work area for reading CSV file
    DATA : wa_csv LIKE LINE OF lt_csv.
    v_filename = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = v_filename
      FILETYPE                      = 'ASC'
      HAS_FIELD_SEPARATOR           = ' '
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        data_tab                      = lt_csv
    EXCEPTIONS
       file_open_error               = 1
       file_read_error               = 2
       no_batch                      = 3
       gui_refuse_filetransfer       = 4
       invalid_type                  = 5
       no_authority                  = 6
       unknown_error                 = 7
       bad_data_format               = 8
       header_not_allowed            = 9
       separator_not_allowed         = 10
       header_too_long               = 11
       unknown_dp_error              = 12
       access_denied                 = 13
       dp_out_of_memory              = 14
       disk_full                     = 15
       dp_timeout                    = 16
       OTHERS                        = 17
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    DATA : BEGIN OF item OCCURS 0 ,
            t1(20) TYPE c,
            t2(20) TYPE c,
            t3(20) TYPE c,
            t4(20) TYPE c,
            t5(20) TYPE c,
            t6(20) TYPE c,
            t7(20) TYPE c,
            t8(20) TYPE c,
           END OF item.
    DATA : txt(1) TYPE c. " 1-Header 2-Item
    LOOP AT lt_csv into wa_csv.
    split wa_csv-text at ',' into item-t1
                                  item-t2
                                  item-t3
                                  item-t4
                                  item-t5
                                  item-t6
                                  item-t7
                                  item-t8.
    append item.
    clear item.
    ENDLOOP.
    Check ITEM TABLE
    Regards
    Naresh

  • How can i read local excel file into internal table in webdynpro for abap a

    Could someone tell me how How can i read local excel file into an internal table in webdynpro for abap application.
    thank u for your reply

    Deep,
    File manuplations...............................
    1. At the presentation level:
    ->GUI_UPLOAD
    ->GUI_DOWNLOAD
    ->CL_GUI_FRONTEND
    2. At the application server level:
    ->OPEN DATASET : open a file in the application server for reading or writing.
    ->READ DATASET : used to read from a file on the application server that has been opened for reading
    -> TRANSFER DATASET : writing data to a file.
    -> CLOSE DATASET : closes the file
    -> DELETE DATASET : delete file
    If file is on the local PC,use the function module GUI_UPLOAD to upload it into an internal table by passing the given parameters......
    call function 'GUI_UPLOAD'
    exporting
    filename = p_file
    filetype = 'ASC'
    has_field_separator = '#'
    tables
    data_tab = t_data
    p_file : excel file path.
    t_data : internal table
    <b>reward points if useful.</b>
    regards,
    Vinod Samuel.

  • How to read an excel file in webdynpro application

    Hello Experts,
    Can someone please tell me how to read an excel file in a webdynpro application?
    There is a tutorial for how to write contect into an excel, but i want to read the excel.
    Can someone help please !!
    Thanks and Kind regards,
    G.Singh.

    Hello Experts,
    I have done all the given above.
    I want to read a excel file from KM. My code is as below
    ResourceContext resourceContext = buildResourceContext();
    IResourceFactory resourceFactory = ResourceFactory.getInstance();
    RID pathRID = RID.getRID("/documents/ExcelReport.xls");     
    IResource resource =     resourceFactory.getResource(pathRID, resourceContext);
    Workbook wb = Workbook.getWorkbook(resource.getURI().getPath());
    Sheet sh = wb.getSheet(0);
    int columns = sh.getColumns();
    int rows = sh.getRows();
    wdComponentAPI.getMessageManager().reportSuccess(" Rows: " + rows);
    wdComponentAPI.getMessageManager().reportSuccess(" Columns: " + columns);
    This does not give me the excel file form the KM
    Can you please just what i can do at this point?
    Kind Regards,
    G Singh.

  • How to sent importet RAW files into the cloud? The files was importet from Canon EOS via camera adapter to the iPad. The Files was stored in the folder importet. But the files does not sync with photostream.

    How to sent importet RAW files into the cloud? The files was importet from Canon EOS via camera adapter to the iPad. The Files was stored in the folder importet. But the files does not sync with photostream.

    Welcome to the Apple community.
    Only photos taken on the iOS device and after photo stream was enabled will be added to photo stream.

  • How to import jar & exp file into the eclipse 3.1 + jcop

    hi, I am new to the javacard technology.
    I have implementing applet by using eclipse 3.1 + jcop plugin.
    recentlly, i got jar and exp file from someone. and I have to import given two files in the my applet.
    Q1. but i don't know how to use(import) two files into the elipse.
    and...
    I have tried to put the export file structure in the build path, but I am still getting the same error:
    Q2. "resolving constant-pool of clazz cash/ccash; failed: no such clazz cash/ccash;", what means?
    anyone help me~plz!
    many thanks..
    lsh.
    Message was edited by:
    neonoble

    1) In the Package explorer right-click the project you want to import the jar files into.
    2) Click import
    3) Select Archive file in the Import dialog box and click next
    4) Browse to the jar file and select it
    Socx

  • How do I get my file into the time line in Premiere Pro CC?

    How do I get my file into the time line in Premiere Pro CC? I am use to Premier Pro CS6 and unfortunately my labtop took a crash and I lost all of my adobe products. I wanted to check out a trial version and I cannot seem to find one for CS6! Please Help Me! My project is due tonight!!!!!

    Hi Aneumann,
    Welcome to the Forums.
    You have to just right click on the clip imported, in the project panel and select new sequence from clip. You can also go to file menu>new>sequence and create a sequence and then drag the clips after importing them , into the timeline.
    Regards,
    Vinay

  • How to import a excel file into database?

    hi all,
    How can I import a excel file into database?
    What I need to do first?
    Thanks,
    Amy

    1. Create a conrtol file in your disc(with notepad) ex
    test_loader.ctl
    LOAD DATA
    INFILE='C:\Testcsv.csv'
    into table test_table
    FIELDS TERMINATED BY ','
    TRAILING NULL COLS
    (ID,COL1,COL2,COL3)
    The table descrption is
    scott@ORCL> desc test_table;
    Name Null? Type
    ID NUMBER
    COL1 VARCHAR2(10)
    COL2 VARCHAR2(10)
    COL3 VARCHAR2(10)
    scott@ORCL>
    2 .Create a file testcsv.csv from your excel file you want to load with " save as" csv comma seperated value
    in your hard disc c:\
    3. in dos command mode write
    C:\>sqlldr scott/tiger control=c:\testcsv.ctl log=c:\testcsv.log
    Thats it!

  • After creating a new user account, how do I move my files into the new user?

    I have an issue where my 'Desktop/Screensaver' prefs seem to be corrupt somehow. When I click on that icon in System Preferences, it stalls and I get the spinning ball, thus resulting in a force quit. After reading a Mac Format magazine where someone wrote in with a similar issue, they said to trash various prefs (did that and made no difference) and if that didn't work, try creating a New User account (therefore creating brand new system prefs) and move your stuff over.
    Well, I've created the New User account, but I can't figure out how to move/copy my stuff into the user folders. After copying and attempting to move stuff in, I see folders with a red circle with a white line through it (like a 'no entry' sign).
    Any clue as to how this can be done? All I'm trying to do is to reinstate the system prefs so they are not corrupt anymore on my log-in.

    No. Not the main Library folder. Make absolutely sure you are in the Home Library folder and not the main Library folder.
    Your Home Library folder is hidden in Lion. To get to it, in the Finder menu, select GO and hold the option key down. Select Library in the submenu. The Finder window will open in your Home Library. This is where your user prefs are stored.
    Once there, you will see the Preferences folder. Open it up, select all items within it and move them to the trash. You will need to restart in order for the new Finder preferences to be recreated.
    Once you restart, then you will be back to the default preferences to the system and all applications. And yes, it will affect all settings including your Dock, just as logging into a new user. You will have to reset everything there also.
    If you wish to do a selective method, instead of deleting all preferences, try deleting the one associated with your problem. Screen saver problems should be affected by the system preferences, so try deleting this:
    com.apple.systempreferences.plist
    com.apple.systempreferences.plist.lockfile
    Note that when you delete system file preferences, a restart will be required. For applications, just quit the application before trashing preference files.

  • How to dump a excel file in the mysql db?

    Hi,
    I just want to dump a excel file in the mysql db.
    Can you please tell, how it can be done?
    what steps should I taken for that?
    Please help me.
    Thanks

    gauravjlj wrote:
    Hi,
    I just want to dump a excel file in the mysql db.
    Can you please tell, how it can be done?
    what steps should I taken for that?
    Please help me.
    ThanksDoes this have anything to do with Java?

  • How to import a XML file into the document?

    Hai,
    i had created a table using xml file....
    Now i want to import that xml file tabel into the document...
    Can any one tell me how to import the xml file into the document?
    thanks
    senthil

    Hai...
    this is senthil...
    i'm beginner for creating adobe indesign plugins..
    i want to import a html file in the document...
    i want to create a table by using html tags and
    that table will be imported into the document..
    How shall i do it?
    can any one plzz explain me?

  • How to import an .csv file into the database?

    and can we code the program in JSP to import the.csv file into the database.

    It is better to use Java class to read the CSV file and store the contents in the database.
    You can use JSP to upload the CSV file to the server if you want, but don't use it to perform database operations.
    JSPs are good for displaying information on the front-end, and for displaying HTML forms, there are other technologies more suitable for the middle layer, back end and the database layer.
    So break you application into
    1) Front end - JSPs to display input html forms and to display data retrieved from the database.
    2) Middle layer - Servlets and JavaBeans to interact with JSPs. The code that reads the CSV file to parse it's contents should be a Java Class in the middle layer. It makes use of Java File I/O
    3) Database layer - Connects to the database using JDBC (Java Database Connectivity), and then writes to the database with SQL insert statements.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Keeping the above concepts in mind, first build a simple JSP and get it to work,
    then research on Google , for Java File I/O , discover how to read a file,
    Then search on how to readh a CSV file using Java.
    After researching you should be able to read the CSV file line by line and store each line inside a Collection.
    Then research on Google, on how to write to the database using JDBC
    Write a simple program that inserts something to a dummy table in the database.
    Then, read the data stored in the Collection, and write insert statements for each records in the collection.

  • CRM ABAP How to upload an Excel file into an internal table?

    How to upload an Excel file using GUI_UPLOAD?? what should be the values of the parameters? The function modules ALSM_EXCEL_TO_INTERNAL_TABLE and KCD_EXCEL_OLE_TO_INT are not present in CRM. Please suggest me a way out!

    Hi saurabh,
    you can try the folowing sample..
    and make modifications according to your requirement..
    TYPE-POOLS: truxs.
    DATA: i_text_data TYPE truxs_t_text_data,
    v_filename_string TYPE string.
    DATA: BEGIN OF itab OCCURS 0,
    Name(30),
    Phone(15),
    Fax(500).
    DATA: END OF itab.
    PARAMETERS: p_file LIKE rlgrap-filename.
    START-OF-SELECTION.
    v_filename_string = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = v_filename_string
    filetype = 'ASC'
    has_field_separator = 'X'
    * HEADER_LENGTH = 0
    * READ_BY_LINE = 'X'
    dat_mode = ''
    * IMPORTING
    * FILELENGTH =
    * HEADER =
    TABLES
    data_tab = i_text_data
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    EXPORTING
    i_field_seperator = 'X'
    * I_LINE_HEADER =
    i_tab_raw_data = i_text_data
    i_filename = p_file
    TABLES
    i_tab_converted_data = itab
    EXCEPTIONS
    conversion_failed = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    this is a sample code that uploads a excel file using GUI_UPLOAD, but uses another function module to convert that uploaded data into an internal table..
    regards
    satesh

  • How to read\write text file into oracle database.

    Hello,
    I am having text file called getInfo in c:\temp folder. I would like to populate data from text file to data base. How to proceed. Could anybody help me out.
    Thanks,
    Shailu

    Here is a web page with easy to follow instructions regarding external files: http://www.adp-gmbh.ch/ora/misc/ext_table.html.
    Now I understand what all the excitement is over external tables.
    "External tables can read flat files (that follow some rules) as though they were ordinary (although read-only) Oracle tables. Therefore, it is convenient to use external tables to load flat files into the DB." -from the above link.

Maybe you are looking for

  • Mac black screen when opening files in Creative cloud products

    I have pasted the system log below the issue occured around 16:20, the iMac was recently upgraded to Mountain lion at the same time roughly a week ago upgraded from CS5.5 to creative cloud, no issues until two days ago Oct  1 16:10:57 localhost com.a

  • Can't Get Dual Monitors to Work

    My main monitor is connected via DVI and my second monitor is using a VGA cable.  I've tried just about everything and can't get the 2nd monitor to display.   When using AMD Catalyst Control Center, the "Detect Displays" section can only find my main

  • Can I delete all the contacts from Facebook in my phone contact list.. !!!

    I am a new i phone ower...  had Droid for over 4 years..   Currently... I miss my Droid!!...  iphone seems to control me.. and I hate that I have to use itunes..   Now it tells me (iphone 5).. I can not delete those off my phone contacts from Faceboo

  • HP 720c in windows 7 64bit "out of paper"

    Added the driver for the 720 c I found on this site. Windows 7 shows the printer and says it is working properly. It is connected to the PC via a parallel port card in a pci-e slot. Shows on port LPT1 and no conflicts are seen. When  I print to this

  • "Invisible" e-mail in my Inbox

    Here's a weird one that I can't figure out. Several days ago, I was mass deleting about 25 e-mails from my inbox (POP account). After selecting the ones to delete, I hit the "delete" button, & my iPhone froze. After resetting, those messages were no