Import data from excel/csv file in web dynpro

Hi All,
I need to populate a WD table by first importing a excel/CSV file thru web dynpro screen and then reading thru the file.Am using FileUpload element from NW04s.
How can I read/import data from excel / csv file in web dynpro table context?
Any help is appreciated.
Thanks a lot
Aakash

Hi,
Here are the basic steps needed to read data from excel spreadsheet using the Java Excel API(jExcel API).
jExcel API can read a spreadsheet from a file stored on the local file system or from some input stream, ideally the following should be the steps while reading:
Create a workbook from a file on the local file system, as illustrated in the following code fragment:
          import java.io.File;
          import java.util.Date;
          import jxl.*;
         Workbook workbook = Workbook.getWorkbook(new File("test.xls"));
On getting access to the worksheet, once can use the following code piece to access  individual sheets. These are zero indexed - the first sheet being 0, the  second sheet being 1, and so on. (You can also use the API to retrieve a sheet by name).
          Sheet sheet = workbook.getSheet(0);
After getting the sheet, you can retrieve the cell's contents as a string by using the convenience method getContents(). In the example code below, A1 is a text cell, B2 is numerical value and C2 is a date. The contents of these cells may be accessed as follows
Cell a1 = sheet.getCell(0,0);
Cell b2 = sheet.getCell(1,1);
Cell c2 = sheet.getCell(2,1);
String a1 = a1.getContents();
String b2 = b2.getContents();
String c2 = c2.getContents();
// perform operations on strings
However in case we need to access the cell's contents as the exact data type ie. as a numerical value or as a date, then the retrieved Cell must be cast to the correct type and the appropriate methods called. The code piece given below illustrates how JExcelApi may be used to retrieve a genuine java double and java.util.Date object from an Excel spreadsheet. For completeness the label is also cast to it's correct type. The code snippet also illustrates how to verify that cell is of the expected type - this can be useful when performing validations on the spreadsheet for presence of correct datatypes in the spreadsheet.
  String a1 = null;
  Double b2 = 0;
  Date c2 = null;
                    Cell a1 = sheet.getCell(0,0);
                    Cell b2 = sheet.getCell(1,1);
                    Cell c2 = sheet.getCell(2,1);
                    if (a1.getType() == CellType.LABEL)
                       LabelCell lc = (LabelCell) a1;
                       stringa1 = lc.getString();
                     if (b2.getType() == CellType.NUMBER)
                       NumberCell nc = (NumberCell) b2;
                       numberb2 = nc.getValue();
                      if (c2.getType() == CellType.DATE)
                        DateCell dc = (DateCell) c2;
                        datec2 = dc.getDate();
                       // operate on dates and doubles
It is recommended to, use the close()  method (as in the code piece below)   when you are done with processing all the cells.This frees up any allocated memory used when reading spreadsheets and is particularly important when reading large spreadsheets.              
          // Finished - close the workbook and free up memory
          workbook.close();
The API class files are availble in the 'jxl.jar', which is available for download.
Regards
Raghu

Similar Messages

  • I need to import data from a CSV file to an Oracle table

    I need to import data from a CSV file to an Oracle table. I'd prefer to use either SQL Developer or SQL Plus code.
    As an example, my target database is HH910TS2, server is ADDb0001, my dB login is em/em, the Oracle table is AE1 and the CSV file is AECSV.
    Any ideas / help ?

    And just for clarity, it's good to get your head around some basic concepts...
    user635625 wrote:
    I need to import data from a CSV file to an Oracle table. I'd prefer to use either SQL Developer or SQL Plus code.SQL Developer is a GUI front end that submits code to the database and displays the results. It does not have any code of it's own (although it may have some "commands" that are SQL Developer specific)
    SQL*Plus is another front end (character based rather than GUI) that submits code to the database and displays the results. It also does not have code of it's own although there are SQL*Plus commands for use only in the SQL*Plus environment.
    The "code" that you are referring to is either SQL or PL/SQL, so you shouldn't limit yourself to thinking it has to be for SQL Developer or SQL*Plus. There are many front end tools that can all deal with the same SQL and/or PL/SQL code. Focus on the SQL and/or PL/SQL side of your coding and don't concern yourself with limitations of what tool you are using. We often see people on here who don't recognise these differences and then ask why their code isn't working when they've put SQL*Plus commands inside their PL/SQL code. ;)

  • How can I import data from a csv file into databse using utl_file?

    Hi,
    I have two machines (os is windows and database is oracle 10g) that are not connected to each other and both are having the same database schema but data is all different.
    Now on one machine, I want to take dump of all the tables into csv files. e.g. if my table name is test then the exported file is test.csv and if the table name is sample then csv file name is sample.csv and so on.
    Now I want to import the data from these csv files into the tables on second machine. if I've 50 such csv files, then data should be written to 50 tables.
    I am new to this. Could anyone please let me know how can I import data back into tables. i can't use sqlloader as I've to satisfy a few conditions while loading the data into tables. I am stuck and not able to proceed.
    Please let me know how can I do this.
    Thanks,
    Shilpi

    Why you want to export into .csv file.Why not export/import? What is your oracle version?
    Read http://www.oracle-base.com/articles/10g/oracle-data-pump-10g.php
    Regards
    Biju

  • How to import data from a text file into a table

    Hello,
    I need help with importing data from a .csv file with comma delimiter into a table.
    I've been struggling to figure out how to use the "Import from Files" wizard in Oracle 10g web-base Enterprise Manager.
    I have not been able to find a simple instruction on how to use the Wizard.
    I have looked at the Oracle Database Utilities - Overview of Oracle Data Pump and the Help on the "Import: Files" page.
    Neither one gave me enough instruction to be able to do the import successfully.
    Using the "Import from file" wizard, I created a Directory Object using the Create Directory Object button. I Copied the file from which i needed to import the data into the Operating System Directory i had defined in the Create Directory Object page. I chose "Entire files" for the Import type.
    Step 1 of 4 is the "Import:Re-Mapping" page, I have no idea what i need to do on this page. All i know i am not tying to import data that was in one schema into a different schema and I am not importing data that was in one tablespace into a different tablespace and i am not R-Mapping datafiles either. I am importing data from a csv file.
    For step 2 of 4, "Import:Options" page, I selected the same directory object i had created.
    For step 3 of 4, I entered a job name and a description and selected Start Immediately option.
    What i noticed going through the wizard, the wizard never asked into which table do i want to import the data.
    I submitted the job and I got ORA-31619 invalid dump file error.
    I was sure that the wizard was going to fail when it never asked me into which table do i want to import the data.
    I tried to use the "imp" utility in command-line window.
    After I entered (imp), i was prompted for the username and the password and then the buffer size as soon as i entered the min buffer size I got the following error and the import was terminated:
    C:\>imp
    Import: Release 10.1.0.2.0 - Production on Fri Jul 9 12:56:11 2004
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    Username: user1
    Password:
    Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Produc
    tion
    With the Partitioning, OLAP and Data Mining options
    Import file: EXPDAT.DMP > c:\securParms\securParms.csv
    Enter insert buffer size (minimum is 8192) 30720> 8192
    IMP-00037: Character set marker unknown
    IMP-00000: Import terminated unsuccessfully
    Please show me the easiest way to import a text file into a table. How complex could it be to do a simple import into a table using a text file?
    We are testing our application against both an Oracle database and a MSSQLServer 2000 database.
    I was able to import the data into a table in MSSQLServer database and I can say that anybody with no experience could easily do an export/import in MSSQLServer 2000.
    I appreciate if someone could show me how to the import from a file into a table!
    Thanks,
    Mitra

    >
    I can say that anybody with
    no experience could easily do an export/import in
    MSSQLServer 2000.
    Anybody with no experience should not mess up my Oracle Databases !

  • How to import data from excel or csv files to Oracle table

    hello everybody,
    I am new here and new in Oracle. I would like to know the steps how to import data from excel or csv files to Oracle table.
    Let say I already have table inside the Oracle. Then my user give me the sets of data inside the Excel Worksheet.
    So, how can I import the excel data into Oracle table.
    Thank you in advance.
    cheers,
    shima

    Even easier. Download JDeveloper 11G from this site.
    Set up the database connection, right click on the table, select Import->Excel and specify your file to load it. On the import pop-up, you must view and update each tab indicating Columns, Data Types, and DML.
    Columns -- move the selected columns that you want to load to the box on the right
    Data Types -- select column name from second column to which the data for each column of the import file should load
    DML -- click this tab to generate the INSERT SQL
    Once done click 'Insert'

  • Import data from excel file

    Hello.
    Is anybody can help how to import data from excel file to the form created with designer 7.0. Originally there is a script inside the form to populate drop down list and depending from data selected in the ID number drop down list, there will be filled out the description and the prices text fields. But now I have to modify this form with data from excel file, which has more than 30000 lines and put all this data to script is too much.
    So, can somebody know how can I after filling the ID number field , populate the description and price text fields with data from excel file corresponding to this ID number ?
    This form is used in Adobe reader.
    Any comments are welcome.
    Regards,
    Aivar

    Hi
    That's what i said in my prev. Post to clear cache... :)
    disable your cache from nqsconfig.ini
    In cache section of NQSConfig file,
    you find
    ENABLE     =     YES;
    set to NO
    OR
    if you are using data ware house as the source for OBIEE,
    you know that when ETL is done, so just create iBot to purge cache automatically at that particular intervals,
    So that report runs freshly at that time
    And what happened to your View Selector question?
    Edited by: Kishore Guggilla on Jul 3, 2009 3:52 PM

  • Import data from excel file - best practice in the CQ?

    Hi,
    I have question related to importing data from excel file and creates from those data a table in the CQ page. Is inside CQ some OOTB component which provides this kind of functionalities? Maybe somebody implement this kind of functionality or there is best practice to do this kind of functionalities?
    Thanks in advance for any answer,
    Regards
    kasq

    You can check a working example package [1] (use your Adobe ID to log in)
    After installing it, go to [2] for immediate example.
    Unfortunately it only supports the old OLE-2 Excel format (.xls and not .xlsx)
    [1] - http://dev.day.com/content/packageshare/packages/public/day/cq540/demo/xlstable.html
    [2] - http://localhost:4502/cf#/content/geometrixx/en/company/news/pressreleases/my_personal_bes ts.html

  • Error while importing data from excel to forms

    Hi,
    I am working on Oracle forms 10g, and I'm supposed to import data from excel sheet to forms.
    While the user enters the data,sometimes after entering a particular word he/she hits the alt+enter button.
    As a result the data appears in two lines in a single row
    So,when I try to import the data it's not importing the data in a right manner.
    S0,I want to replace this linefeed and carry with five spaces.
    Eg:The user instead of entering Geekpedia enters Geek
    pedia
    in the excel sheet.
    Now when I import this in the forms I want it to be imported as Geek Pedia.(5 spaces between Geek and pedia).

    Maybe you can consider save excel as .csv files and then you can load them as flatfiles to external table in OWB.

  • Is there a way to import data from excel -when one of the columns in excel is hyperlink column?

     Is there a way to import data from excel  - so if a column is hyperlink - the whole data will move to the list (text + link of the hyperlink column)?
    keren tsur

    Hi,
    According to your description, you want to export excel which contains a hyperlink column to SharePoint list.
    Refer to the following steps:
    Open the Excel, insert/create the table. 
    Now click on any cell of table and go to the ‘Design Tools’.
    Click on the Export and then ‘Export table to SharePoint List’.
    You will see a popup where you need to provide the URL of SharePoint site, list name and description.
    Then click on next, On the next screen you will see columns with data types which are going to create in SharePoint list.
    Now click finish and wait until the operation gets finished. You will see that list gets created in SharePoint site with the records.
    Here are two links, you can use as a reference:
    http://sharepointrhapsody.com/2013/03/25/how-to-create-a-connected-excel-file-to-sharepoint-list/
    http://social.technet.microsoft.com/wiki/contents/articles/18705.sharepoint-2013-how-to-export-excel-sheet-to-sharepoint-list.aspx
    Best Regards,
    Lisa Chen
    Lisa Chen
    TechNet Community Support

  • Import data from excel

    Hi, I am using Jdeveloper 11g 11.1.1.5.0 and I want to import data from excel in my table through the jsf page and commit it to database. How can I implement it. Its urgent please help me!!!!!!!!!!!!!!!!!!!!!

    Unless you are importing Excel data to save a dying patient in the operating theatre, it's not, by definition, urgent!!!!!!!!!!!!!!!!!!!!!! (and I must be right, because I used 22 exclamation points, where you only used 21).
    Have you looked at ADF Desktop Integration to see if that would work for you? If not, you could:
    1). Use an af:inputFile to upload the Excel file
    2). Using something like Apache POI to read the file
    3). Create rows, set the attributes, insert them, and commit them (if you're using ADF BC, you'd use a View Object to do this)
    John

  • Import data from excel 2013 workbook issue,is it a bug ?

    When I use powerquery to import data from excel 2013 workbook An unexpected error occurred.Other editions no problem.

    I‘m sure this is a bug.I'm option in default language set to English.Saved the file and use powerquery import it.Excle worked fine.
    I'm option in default language set to simple chinese.Saved the file and use powerquery import it.An error occurred.

  • Giving dynamic sheet name while importing data from Excel in OPENROWSET query

    I want to import data from Excel to table in SQL server. Sheets in Excel file can have any name. I want to get data from first sheet of the excel file. 
    CREATE PROC CopyExcelDataToTempTable
    @ExcelPath VARCHAR(1000)
    AS
    BEGIN
    EXEC sp_configure 'show advanced options', 1;
    RECONFIGURE;
    EXEC sp_configure 'ad hoc distributed queries', 1;
    RECONFIGURE;
    EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1;
    EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1;
    INSERT INTO TempData
    SELECT *
    FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
    SELECT CONCAT('Excel 12.0 Xml;HDR=YES;Database=', @ExcelPath),
    'SELECT * FROM [Sheet1$]');
    END;
    Currently I am giving Sheet1 as static name in Select statement. But my sheet name is not fixed. I want to create a dynamic query. If getting Sheet name is not possible then can we put sheet with its index in Select query? There is no front end. Whatever I
    want to do is in SQL server 2012. Is there any solution for this problem?

    Hi Ajinkya,
    To get the sheet names from an excel, you can use the Stored Procedure
    SP_TABLES_EX. See the below code.
    EXEC sp_addlinkedserver 'ExcelSource', '',
    'Microsoft.ACE.OLEDB.12.0',
    'c:\worksheet.xls',
    NULL,
    'Excel 8.0'
    EXEC sp_addlinkedsrvlogin 'ExcelSource', 'false'
    GO
    EXECUTE SP_TABLES_EX 'ExcelSource'
    the names in the worksheet.xls and execute result are like below.
    Table name
    a
    b
    c
    d
    Regarding your description, you need the first sheet of your excel. As the result shows, the sheet names are sorted, so there’s no guarantee to get the first one. The SP can work as a workaround when there’s only one sheet in your excel or the required sheet’s
    name is customized to be sorted at the top first.
    If you have any question, feel free to let me know.
    Best regards,
    Eric Zhang

  • Error in importing data from multiple ASCii files, Concatenat​e

    I am trying to use the "Importing Data From Multiple ASCII FIles.VBS" and the "Concatenate Groups.VBS" scripts downloaded from here, http://zone.ni.com/devzone/cda/epd/p/id/3870. When I run the importing data script and test it by highlighting the example data that comes with the download I get an error. "Error in <Importing Data From Multiple ASCII Files.VBS> (Line:60, Column: 11):  Variabls is undefined: 'AscIIAssocSet'  "
    The offending line of code is "  Call AsciiAssocSet(FilePaths(i), StpFilePath) ' assign STP file    "
    Screenshots of the error are attached.
    Can anyone tell me what this error is?  Am I just doing something wrong? Getting quite frustrated.
    Thanks in advance.
    Attachments:
    concactenate1.png ‏261 KB
    concactenate2.png ‏243 KB

    Please have a look at the DIAdem Example to concanate channels. Its delivered with DIAdem.
    Examples > Creating Scripts > Scripts > Appending Channels to Each Other
    Please use a dataplugin (File -> Text DataPlugin Wizard...) or the csv plugin to load your data.
    Greetings
    Andreas
    P.S.: The one you have downloaded needs the old Ascii Wizard that is not activated by default in newer DIAdem versions.
    If you want to use it anyway:
    Settings -> Options -> Extensions -> GPI Extensions ...
    Add gfsasci.dll

  • Importing data from an .mht file

    I would like to import data from a *.mht file. I can open the file in excel and save it as excel but I want to automate this in SSIS. I found a command line tool but it's not doing it correctly but excel does.
    Can I do this in VB script in a VB task?
    OR is there an odbc provider for the .mht file so I don't need to convert it at all?
    Thanks,
    Linda

    it converts to an excel manually and then can import it just fine. it's a report and the source will only give us an .mht file for importing into our database.
    any ideas how to automate converting to excel in VB script or do I have to build an .exe and run it via command line or something?
    Thanks
    I seriously doubt anyone around here will know how to do this I'm afraid because its nothing to do with SSIS. What I do know is that you can use the Office PIAs to automate many Excel tasks from .Net code so if you can figure out how to do that then you put the code inside a SSIS script task. At that point we may be able to offer some assistance but not until then.
    In other words, if you want to programatically open the .mht file in Excel you'd be better advised to get the advice elsewhere I'm afraid.
    -Jamie
    http://sqlblog.com/blogs/jamie_thomson/ | http://jamiethomson.spaces.live.com/ | @jamiet

  • Importing data from excel  ... when clicking finish button nothing happens

    Version 3.1/32bit version ... I am trying to import data from excel but when i clicki finish button nothing happens. any idea. this used to work fine on the older version?

    Hi,
    Generally speaking, the data import from an xls or xlsx format Excel file works. You need to provide more information about your environment and the Excel file itself -- size, data types of the columns, number of worksheets, etc.
    I recommend running sqldeveloper.exe (not sqldeveloperW.exe) from a command line window. Repeat your import test and see if any stack trace appears in the console. For example, trying to open a 0 byte xls file results in a stack trace like this:
    java.lang.NullPointerException
            at oracle.dbtools.raptor.data.readers.XLSReader.openFile(XLSReader.java: 524)
    ...Regards,
    Gary
    SQL Developer Team

Maybe you are looking for

  • Small virtual company setup

    I am trying to set up a small virtual company and am not sure how to find topics that discuss how to do it. Sorry if this question has been answered before. We have three computers shared by two users at the main office. Both users have laptops and t

  • ITunes 11.0.44

    Although, there are dozens of posts about iTunes 11.0.44 causing problems with album art, I can't seem to find one with my specific problem. Prior to iTunes 11, I had no problem tagging my album art to my music. With the release of iTunes 11, my albu

  • Problem in form based authentication

    Hi, I am encountering some problem in form based authentication. When I try to login for the first time. It reoute me to the image directory and not to the request page. When I try it for the second time, it shows "Form based authentication failed. C

  • Reg. arear(verzn) value from fbl15n

    Hi all, Is any way ( any functional module or BAPI) to get the value for arear(verzn field) in the line items of FBL5n tcode based on customer,company code,document no, reference no. posting date thanks suresh

  • Schema procedures access in oracle portal

    Hi I have created a procedure under my schema and grant execute access to portal user. However, when I tried to execute the procedure from a report as portal user, it said procedure not found. When I created the same procedure under portal_public sch