Importing Excel Files and Formatting Issues

Good afternoon ladies and gentlemen. When in doubt, post in the forum! Anyway, I am using java via ODBC to connect to an excel file to extract some info from it, using SQL statements. Everything can be extracted without any problems, however, Excel keeps pi$$ing me off by changing the format of the cell data.
Firstly, I highlight every cell in my Excel file and format it as "Text."
Then I extract the cell info by using a ResultSet and getting a String (even for numeric data - ResultSet.getString(...))
What is getting on my nerves is that not only does it not extract numeric values followed by a string, when it does extract numeric values, it is adding a ".0" after the value.
For example, if the cell value is 123, it will return 123.0
If the cell value is 123SHOE, it returns null
Furthemore, when editing the Excel file, after having every cell formatted as "Text," if I enter a number, say, as a zipcode, 123450000, it brings up an error! But the very definition of "Text" states that "Text format cells are treated as text even when a number is in the cell."
The moral of the story is, I want to convert all data in the Excel file to "Text" and when extracting data from the file, I need to be able to extract numbers, numbers followed by characters, and everything else.
Any suggestions?
Thanks much,
Josh

Hey Dr. Clap, quick question for ya. I was checking out the Apache POI you recommended. More specifically HSSF. I noticed in the documentation that "String cells cannot conatin numbers and numeric cells cannot contain strings." Unfortunately, this is not going to work well with my app as some of the primary keys (I use the term loosely) are Strings which contain numbers. My main problem is that my app wont recognize the Strings containing numbers, so it returns null, and Excel is chopping off the leading zeroes and is popping up with an error because numbers are in the String. However, as I stated before, Excel notes that text cells can contain numbers!
FYI, I am using Pervasive SQL to extract a given list of users in a DB (which I dont want to connect to directly) and am saving that generated query (list of users) into a text file. I then open the text file in Excel which parses it correctly and assigns the cells the correct values. So I don't think I can format the cells as text because I am importing the file I generate. I love doing things ass backwards :) Another reason I am using Excel files is so anyone can use the software so long as they have an Excel file with the appropriate columns within the file.
Thanks yet again and I'll keep searching.
Josh

Similar Messages

  • Importing Excel files and using a search function to use specific data based on user selection

    Hi, I'm trying to create a search and solve function within Visual Basic.
    I want to use the combustion equation C8H18 + 20(O2 + 3.76 N2) = 8 CO2 + 9H20 + 47 N2 to determine flame temperature using
    9*Hf of C02 + 8 * Hf H20 + 47 Hf N2 = Hf C8H18
    I have all of the values of Hf in an excel spreadsheet but I want to be able to search the spreadsheet as my application requires the user to change to fuel (the C8H18 bit) which changes the value of Hf.
    Is there a way of searching that excel file each time I run my program?
    Thanks
    Jack

    Thanks for answering so quickly.
    I've used that method before, and I'm sorry I didn't specify. 
    This will be used as a student learning aid and so the application itself and the tables will be downloaded as a zip file and so I don't believe the line below would work?
    I've heard about including excel as a reference file in the application but I haven't been able to find any further information on that.
    Thanks again
    Dim oWBa As Excel.Workbook = oApp.Workbooks.Open("C:\Users\v-youtan\Desktop\colleagues.xlsx")"

  • Adding hyperlinks to imported excel file cells

    Good Afternoon All,
    I am having trouble assigning hyperlinks and defining names to the individual cells of an imported excel file (import into Visio). Ideally, I would like to be able to hyperlink shapes in other Visio pages (of the same
    workbook) to individual cells of the imported excel file and vice versa.  Is there any way of doing this? 
    Please let me know if I can clarify.
    -Tom

    In a similar thread from a few days ago:
    Albert Geven wrote:
    > You can also download from the developer zone our excel (goop)
    >library.
    >search for philips and you'll find it.
    We've used this with good success for creating multiple worksheets. If you
    like goop, its great. It may be worth a look for you. It's at this link
    http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&42E12CDCDBD1C682
    8625699D004EEFA8&cat=9C6DF90777E5A78206256874000FA14E
    Spencer
    "Jeff - PPL" wrote in message
    news:[email protected]..
    > Is it possible to send data to two different worksheets in an excel
    > file? For example, I have raw data and then calculations from that
    > raw data. Right now I have the raw data being sent to the exc
    el file.
    > I would like to be able to send the calculation results to the same
    > file but a new worksheet. Is this possible?
    >
    > Thanks

  • Place Excel file and keep accurate formatting

    In my organization, InDesign is used for creating several rather comprehensive price lists (500 pages and more ...).
    Needless to say, each price list contains a lot of tables. Currently we
    create tables in Excel,
    save it as pdf file and
    place the pdf in InDesign
    Of course, that's cumbersome (no Edit Original command --> each modification in the original table restarts the above mentioned process) - that gives us a hard time dealing with hundreds of tables... 
    It would be ideal to place Excel files directly - but after hours of trial & error I'm still not able to insert a table AND keep the accurate Excel-formatting. There are always some smaller or bigger deviations (unexpected line breaks, overset content, wrong line-styles, colors etc.)
    What I did:
    Enabled "Create Links When Placing Text and Spreadsheet Files" in the File Handling Preferences
    Enabled "Import Options" when placing the Excel file
    Choosed "Formatted Table"
    It seems that some older xls files are more likely to raise problems. Newly-created xlsx files are fine most of the time (saving xls to xlsx doesn't make a difference though).
    What are your experiences on importing excel files? Thanks for any hint!
    Regards,
    Florian

    Thanks, Willi.
    The reason why we currently place our tables as PDF is, that we want to avoid any additional setup in InDesign. In fact we use InDesign "merely" to place & arrange all objects like tables, images, text etc. properly. There is no editing or formatting of content done in InDesign (Excel-spreadsheets are well-designed anyway) - I think otherwise our loads of price lists for different countries wouldn't be manageable at the moment ...
    I'm just looking for a way to keep the advantage of placing PDFs (retain accurate form) and eliminate the disadvantages (additional step of saving each spreadsheet as PDF and lack of the "Edit Original" option).
    Any ideas are appreciated!
    Florian

  • Help needed with referencing single Excel cells and formatting resulting text

    In InDesign CS5 I am putting together a 20pp catalogue of about 200 products. The plan is to have the product information, SKU code, quantity etc fixed, but have the prices (there are two i.e. pack price and individual price) being linked to an Excel spreadsheet. This is so that the prices can be updated in the Excel file and the InDesign file will pull the new prices through. In case you are wondering why I don't pull the whole set of information through, this is because there are a lot of copywriting changes done to the information once it's in InDesign - it's only going to be the prices that will be updated.
    I am planning on having two single cell tables in their own text frame, duly formatted with cell style, table style and paragraph style for the two price variables. This I am then going to have to repeat 200 times making sure I link to the next row down in Excel. This is going to be a hideous task but I see know way of modifying the cell in InDesign to point it to the next row in Excel. That's my first problem.
    My second problem is this. In the Excel sheet, the prices are formatted as UK currency and are therefore like this...
    £2.00
    £0.40
    £1.43
    £9.99
    £0.99
    £0.09
    What I will require is once I import that data (and refresh the data via a newly saved Excel file) is that the prices end up like this...
    £2.00
    40p
    £1.43
    £9.99
    99p
    9p
    So if the value is lower than £1.00 it needs a trailing 'p' added  and the leading zero and '£' sign stripped off. If the value is lower than £0.10 it also needs the zero after the decimal point stripping off.
    Then formatting wise, the '£' sign needs to be superscripted and the same for the 'p'. This I am assuming could be done via GREP?
    In summary, can anyone help with the first task of referecing the Excel cells on a cell by cell basis, given that it is the same cell column each time, but the next row down, and also point me in the right direction of the price formattting issues.
    Any help will be gratefully received.

    I would do this:
    Create on line with the formatting.
    Export as InDesign tagged text (TXT)
    Read out these tags
    In Excel exists a function to connect text from several cells and predfined text, there connect the content from cells with the paragraph styling tags. Do it in a seperate sheet. (Better would be to use a database like Access, there you can link your Excel sheet).
    Export this sheet as txt file
    Place this sheet as tagged text (there is an option in one of the sialog boxes).
    In preferences  < file handling you can specify that Tablecalculation Sheets and text is not embedded but linked, turn it on.

  • Importing excel file into OBIEE 10.1.3.4

    Hi,
    I am trying to import excel file into OBIEE and would like to use it as a data source. Fro this, I have already created an excel file (using MS excel 2007) with some sample data and named the data ranges with in the excel sheet as well. and I have placed that file under C:\ drive directly. And then created DSN and made sure that it points to the excel file.
    When I go to Administration tool -> Import from Database -> seelct ODBS 3.5 and selected my DSN and clicked OK. Here I have not provided the user name and password (though I have provided the username/pwd as Administrator it is not taking).
    when I click ok, it is throwing the following error :
    nQSerror:16001 ODBC error state : IM006 code: 0 message: [Microsoft][ODBCDriver Manager] Driver's SQLSetConnectAttr failed. [nQSError: 16001]ODBC error state: S1000 code - 5015 message: [Microsoft][ODBC Excel Driver] External table is not in the expected format
    Pls help me in rectifying this error. Many thanks in advance.
    Thanks
    Edited by: 858747 on 25-Aug-2011 05:47
    Edited by: 858747 on 25-Aug-2011 05:48

    Hi, I am facing the same issue.
    I am using OBIEE 11g with MS Excel 2007 file as source. I have created ODBC Driver by selecting Microsoft excel driver.
    NQSAdminTool.log gives error:
    ODBC error state: S1000 code: -5015 message: [Microsoft][ODBC Excel Driver] External table is not in the expected format
    The Admin tool gives error: "Unable to connect database using connection pool", when I try to 'update row count' in Physical Layer.
    Any quick resolution to this?
    Many thanks in advance.
    Edited by: user1603699 on 25-Oct-2011 09:28

  • "DBSTATUS_UNAVAILABLE" Error while importing Excel File

    Hello,
    I am getting following error while importing data from Excel 2003 to SQL server using SSIS 2008,  [Excel Source [1]] Error: There was an error with output "Excel Source Output" (9) on component "Excel Source" (1). The column status
    returned was: "DBSTATUS_UNAVAILABLE".
    If i open the excel file and done any editing then the same file loads without any issue. Can you guide me why it's  happening ? , i have edited "TypeGuessRow" property to 0 , IMEX = 1 but no help.
    Thanks

    Hi Ved_Prakash,
    The error is generic and can occur due to various causes. In order to troubleshoot this issue, I need to clarify some information:
    Could you please post some sample data for that column in the error message?
    Have you modify some properties after accessing data from that Excel file?
    Since the error message is incomplete, could you post other error messages from the Output pane?
    Besides, we can also use
    SQL Server Import Export Wizard to import Excel into SQL Server database.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Can't import excel file using Powerpivot Import Table Wizard

    I am new to the powerpivot in 2010 Excel.   I was trying to use the Powerpivot's import table wizard to import an Excel file into Powerpivot.  I was able to connect the target source file when I was in the wizard window testing the connection. 
    However, after I accepted to import the file and clicked finished, I couldn't see all the columns of the file were completely uploaded into the PowerPivot worksheet.  Also, the file has only 138 rows but it ends up over thousands row.  Can you please
    let me kow if this feature works at all or did I miss any steps?

    Hi MySueSue,
    Here are some tutorials about how to Import Excel Data into a PowerPivot Workbook.
    http://msdn.microsoft.com/en-us/library/gg399137(v=sql.110).aspx
    http://technet.microsoft.com/en-us/sqlserver/dn151367.aspx
    If there is anything I can do for you regarding this issue, feel free to post back.
    Best regards,
    Greta Ge
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Is it possible to import excel files automatically?

    Hi,
    I am able to import the excel file manually and the same map I used in port.. format as excel.. its automatic action.. When I place the file it getting picked but giving structural exception... the same file I can manaully process successfully by selecting the same file using type as excel instead of Port...
    When I select type as port, remote system .. when  I want to select port I can see the port which I defined in console but they are disabled.. wondering where I did wrong?? is it possible to import excel files automatcially??
    Thanks
    Rajeev

    Hi,
    Yes you understood corectly.. I am unable to import excel file automatically.. I created a new port with the map which I used manually of type excel... Before placing the file in the ready folder of this newly created port.. I tried to manually import using the port type... I see the port is disable to select.....
    If I place the fiile its throwing structural exception..... but the same file I am able to import using type as excel..
    After structural exception..I am able to select this exceptional port in import manager of type port.. manually it is successfull using the same map and same file which got structural error....
    In Console report says:
    Error: MS Access is not supported on this platform.
    Error: MS Excel is not supported on this platform.
    I am working on MDM 5.5.65.95 AND WINDOWS 7 64bit..
    Any inputs.
    Thanks
    Rajeev

  • How to  read from excel file and write it using implicit jsp out object

    our code is as below:Please give us proper solution.
    we are reading from Excel file and writing in dynamicaly generated Excel file.it is writing but not as original excel sheet.we are using response.setContentType and response.setHeader for generating pop up for saveing the original file in to dynamically generated Excel file.
    <%@ page contentType="application/vnd.ms-excel" %>
    <%     
         //String dLoadFile = (String)request.getParameter("jspname1");
         String dLoadFile = "c:/purge_trns_nav.xls" ;
         File f = new File(dLoadFile);
         //set the content type(can be excel/word/powerpoint etc..)
         response.setContentType ("application/msexcel");
         //get the file name
         String name = f.getName().substring(f.getName().lastIndexOf("/") + 1,f.getName().length());
         //set the header and also the Name by which user will be prompted to save
         response.setHeader ("Content-Disposition", "attachment;     filename="+name);
         //OPen an input stream to the file and post the file contents thru the
         //servlet output stream to the client m/c
              FileInputStream in = new FileInputStream(f);
              //ServletOutputStream outs = response.getOutputStream();
              int bit = 10;
              int i = 0;
              try {
                        while (bit >= 0) {
                        bit = in.read();
                        out.write(bit) ;
    } catch (IOException ioe) { ioe.printStackTrace(System.out); }
              out.flush();
    out.close();
    in.close();     
    %>

    If you want to copy files as fast as possible, without processing them (as the DOS "copy" or the Unix "cp" command), you can try the java.nio.channels package.
    import java.nio.*;
    import java.nio.channels.*;
    import java.io.*;
    import java.util.*;
    import java.text.*;
    class Kopy {
         * @param args [0] = source filename
         *        args [1] = destination filename
        public static void main(String[] args) throws Exception {
            if (args.length != 2) {
                System.err.println ("Syntax: java -cp . Kopy source destination");
                System.exit(1);
            File in = new File(args[0]);
            long fileLength = in.length();
            long t = System.currentTimeMillis();
            FileInputStream fis = new FileInputStream (in);
            FileOutputStream fos = new FileOutputStream (args[1]);
            FileChannel fci = fis.getChannel();
            FileChannel fco = fos.getChannel();
            fco.transferFrom(fci, 0, fileLength);
            fis.close();
            fos.close();
            t = System.currentTimeMillis() - t;
            NumberFormat nf = new DecimalFormat("#,##0.00");
            System.out.print (nf.format(fileLength/1024.0) + "kB copied");
            if (t > 0) {
                System.out.println (" in " + t + "ms: " + nf.format(fileLength / 1.024 / t) + " kB/s");
    }

  • Importing excel files - problem with single quote

    When importing excel files using 1.5, I can't get data with single quotes (') imported.
    When I run the insert statement given in SQLPlus I get "ORA-01756: quoted string not properly terminated", which is different than the error that SQL Developer gives me (see below).
    Also, I have a numeric value shown without a thousands comma-separator in the XLS file that I'm trying to load into a varchar2 field. But, the insert statements have added a thousands comma-separator which I don't want.
    REM Error starting at line 1 in command:
    REM INSERT INTO table (ID, NAME, CODE)
    REM VALUES (2427407, 'Ed-u-care Children's Center', '73,000');
    REM Error at Command Line:2 Column:37
    REM Error report:
    REM SQL Error: ORA-00917: missing comma
    REM 00917. 00000 - "missing comma"
    REM *Cause:   
    REM *Action:
    One last thing, TOAD gives a way to automap columns chosen from XLS to the columns in the database. It sure would be nice to have this functionality in SQL Developer.
    Thanks,
    Steve

    Did you consider both to be bugs (i.e., single quote issue and thousands comma separator issue)?
    Thanks

  • Importing excel files linked to data

    Hi all,
    I have a client that wants to import Excel charts and graphs into InDesign and have InDesign maintain a link to the original dataset in Excel. In a perfect world she would like to update the data in Excel and have the information dynamically displayed in the InDesign chart. Word allows for this type of relationship, but from my research it doesn't look like this is possible with InDesign without using the InDesign Server and XML. Both of which I feel would be too much of an investment for this purpose. So at this point I would just like to confirm my suspicions or hear of any other ways I may not have thought of.
    Thanks.
    cscott

    We're also curious to know any current and/or creative solutions to this issue. Wondering if there are any other methods or experiences on this topic??
    We played with this a long time ago, and from my recollection, if any cells changed (adding, deleting, etc.) in the excel file, the process would break down. It had to be the IDENTICAL file, with only data changing.
    And we may also have tried the PDF from Excel method. But obviously, Excel is not known for it's styling capabilities. This is what we're using InDesign for. So this method probably won't work either.
    - Any other ideas? Plugins? Scripts?
    Thanks.

  • How to import excel file in oracle 10g suit

    Respected all,
    i am working d2k6i now i am going to 10g suit and i want to import excel file so anybody help me how to do it? Thanks in advance.

    Hi,
    This forum is dedicated to Oracle SQL Developer Data Modeler, so it is possible to get an answer here, but it is not very likely.
    Try to get help in in more appropriate forum from here
    https://forums.oracle.com/forums/main.jspa?categoryID=84
    Regards

  • How to update Ztable from Excel file and how to check conditions ,

    HI this uday,
    pls help me how can i update Ztable from Excel file and how to check conditions .
    regards
    uday
    Moderator message: please (re)search yourself before asking.
    Edited by: Thomas Zloch on Jul 13, 2010 12:00 PM

    Hi
    Use Fm : ALSM_EXCEL_TO_INTERNAL_TABLE.
    L_INTERN : internal table with your fields .
    make sure that the fields in the Excel should be formatted (as numeric , characher ) depending upon the data types .
    LOOP AT L_INTERN INTO WA_LINTERN .
            MOVE WA_LINTERN-COL TO L_INDEX.
            ASSIGN COMPONENT  L_INDEX OF STRUCTURE WA_INREC TO <FS> .
            IF SY-SUBRC = 0.
              MOVE WA_LINTERN-VALUE TO <FS>.
            ENDIF.
            AT END OF  ROW .                                    "#EC *
              APPEND WA_INREC TO IT_DATA.  "
              CLEAR WA_INREC.
            ENDAT.
         ENDLOOP.
    Regards
    Swapnil

  • Read a excel file and split its sheets to seperate file ?

    Dear all :
    How to split a excel file into several file, each have one sheet.my code is as below,thanks:
    import org.apache.poi.hssf.usermodel.*;
    import java.io.*;
    import java.util.*;
    import org.apache.poi.poifs.filesystem.*;
    public class Extractxls {
    public static void main(String[] args) throws Exception
    try {
    POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(args[0]));
    HSSFWorkbook wb = new HSSFWorkbook(fs);
    int sheetCount = wb.getNumberOfSheets();
    System.out.println(sheetCount);
    try {
         while(sheetCount > 0) {
         sheetCount--;
         HSSFWorkbook wb1 = new HSSFWorkbook();
         HSSFSheet s = wb1.createSheet();
         String sheetName = wb.getSheetName(sheetCount);
         HSSFSheet sheet = wb.getSheet(sheetName);
    //     HSSFSheet sheet = wb.getSheetAt(sheetCount);
         System.out.println(sheet.toString());
         s = sheet;
    FileOutputStream fileOut = new FileOutputStream("atest" + sheetCount + ".xls");
    wb.write(fileOut);
    fileOut.close();
    } catch (Exception e) {
         System.err.println("Error: " + e.getMessage());
    } catch (Exception e) { e.toString();}

    The HSSFWorkbook class is part of the POI project:
    http://jakarta.apache.org/poi/
    Regards,
    Dave Gilbert
    JFreeChart Project Leader
    I understand poi porject, my problem is that POI can not read a excel file and split its sheets into seperate file (each have one sheet) ?Does any one know how to do it.

Maybe you are looking for