Read Custom format of Excel

I want to read custom date format from excel through JAVA:
Issue:
In my excel cell is of custom format MMYYYY. Which is 011900.
When i click on it It shows me 1/0/1900. I am using jxl.jar for reading excel.
When i am reading it through java it is not taking date as 0. So it is gicing me value 121899. Dont Know why??? Could you please help me. Its very critical to my project.
Thanks in adance.

There could be weird Excel stuff happening, or weird JXL stuff, but basically here's what is happening:
You have Day 0 of Month 1 of 1900. This is treated as the day before Day 1 of Month 1 of 1900, which if you get out your calendar you will see is actually Day 31 of Month 12 of 1899. And if you look at that with a format which displays only the month and year, you'll see 12 as the month and 1899 as the year.
So: don't treat something with only month and year as a Date, unless you're prepared to fill in the day part properly.

Similar Messages

  • Loading Excel data with custom format applied

    Hi,
    I have an Excel File as source with the custom formatting applied to the data in it.
    For Eg. value 64 has special formatting applied so as to display it as 0064.
    BODS loads only the actual data as 64 and though I expect to load the formatted data(0064).
    Is this an expected behavior of BODS?
    DS Version : 14.1.2
    Thanks.

    No. If you define file format as flat file and define the field type as char then you can load all the formatted data like 0064 into DB. If you use excel then excel will remove leading zeros. This is excel functionality. or you can define the input file as CSV file and change the format of the field.
    Thanks,

  • How to read data from a file that was formatted by excel?

    Hi everyone, I'm familiar with java.io and the ability to read from files, can anyone tell me how to read data from a file that was formatted by excel? Or at least give me some web references so that I can learn about it?

    http://jakarta.apache.org/poi/hssf/index.html
    HSSF stands for Horrible Spreadsheet Format, but it still works!

  • How to read a .csv file(excel format) using Java.

    Hi Everybody,
    I need to read a .csv file(excel) and store all the columns and rows in 2d arrays. Then I can do the rest of the coding myself. I would like it if somebody could post their code to read .csv files over here. The .csv file can have different number of columns and different number of rows every time it is ran. The .csv file is in excel format, so I don't know if that affects the code or not. I would also appreciate it if the classes imported are posted too. I would also like to know if there is a way I can recognize how many rows and columns the .csv file has. I need this urgently so I would be very grateful to anybody who has the solution. Thanks.
    Sincerely Taufiq.

    I used this
    BufferedReader in = new BufferedReader (new FileReader ("test.csv"));
    // and                
    StringTokenizer parser = new StringTokenizer (str, ", ");
                    while (parser.hasMoreTokens () == true)
                    { //crap }works like a charm!

  • Opening an Excel file with custom formatting while BEx is open

    Hi,
    we just noticed something pretty weird (first time I see it in my carreer). One of the end users had BEx open (just launched the BEx Analyzer without actually opening a query/workbook) and tried to open one of her "own" Excel sheets out of Explorer.
    The file opened but all of a sudden the custom formatted currency fields changed from US$ amounts to DM amounts??? I assume DM stands for Deutsche Mark (a currency which has not been in use for about 9 years I believe). This "custom" format seems to only appear when BEx is opened. End user has Excel03 with BI AddOn 7.X Support Package 8, Patch 1, Revision 1443. When I do this on my own pc (I have Excel07 and the same BI AddOn), I get exactly the same behavior, be it a bit slower (I can see the file opening with $ amounts which slowly change to DM amounts). There are no macro's in the Excel workbook (was one of my first checks). I also tried opening the file from within Excel, but it gives the same weird behavior. Next check was to open a BI report first (so there was no empty BEx session) and then open the file in Excel... still the same.
    Ok, then I assumed it would use some kind of "marker" to point to the correct entry in the list of custom formats, but even that is not true. In the original file (opened in Excel when BEx is not open), it takes position 43. If I open the file while BEx is open, it takes position 49.
    Did anyone experience this before?
    Cheers,
    RafB

    Hi,
    you are using BI Frontend SP 801 and the next available Frontend SP should provide a fix for the issue. I would recommend to install Frontend SP 902, the latest one. Note [1294215|http://service.sap.com/sap/support/notes/1294215] describes the issue and refers to Frontend SP 900.
    Regards
    Matthias

  • Problem with reading English UK date format in Excel

    When I build and debug the rulebase I get the following error: Error in rulebase: "Cannot perform comparison expression on right expression with type number".
    The actual problem is that it does not read the date correctly in Excel. I have got the following date comparison >=31-09-2011 in excel. Instead of reading 31st September 2011 it tries to reed as 9th of the 31month 2011...
    I have set all language and location, region settings to English United Kingdom (dd/MM/yyyy), United Kingdom but it seems it does not help. In Excel I have set English UK as well.
    OPM version: 10.1.0.27
    Windows 7
    MS Office 7
    I had this problem previously but I resolved by changing language or location setting I think, or language for non-Unicode programs. I cannot remember exactly. But this time it seems it does not work. Reinstalling does not work either.
    Can anybody help with this?
    What settings OPM uses to read the date?
    Thank you!

    Jasmine, you are right 31-09-2011 is a wrong date, I just typed any date as an example and didn't realize that it is an impossible date . We use many dates in Excel in a format dd-MM-yyyy (we do not type in date in runtime).
    In the link you have sent it says that "Formatted attribute values based on rulebase region are used".
    Date:
    " if your region was set to the United States you would see the following: MM-dd-yy"
    "Region set to Australia, which includes the date format dd/MM/yy
    Region in our project is set to United Kingdom so the date format should be dd-MM-yyyy.
    I have checked that OPM Project Properties Language is set to English (UK) so it should be fine.
    The strange thing is that it works fine on other laptops - the date 03-09-2011 is red as 3 September 2011, but on my laptop it is red as 9 March 2011.
    When it comes to read the date 30-09-2011, on other laptops is red as 30 September 2011, but on mine cannot make a date as there is no month number 30 so it throws the error "Cannot perform comparison expression on right expression with type number"... What actually happens is that on my laptop OPM reads the dates from Excel in American format.
    As I wrote earlier, It was working fine at my laptop as well before reinstalling Windows. I had this problem long time ago again but I was able to resolve it by changing language,region settings in Windows I think.
    Now it seems like I have got the same language,region settings in Windows as I had before, my colleagues got the same language, region settings on their machines as well.
    Iit seems like dd/MM/yyyy is red fine (UK format), but the format dd-MM-yyyy is red in American format...
    What settings should be set in Windows or Excel or maybe somewhere else OPM to read the date from Excel in English UK format dd-MM-yyyy?

  • How to delete a custom format in Numbers 3

    I am one of the poor unfortunates that has upgraded to Numbers 3 BIG mistake!!
    However does anyone know how to delete a custom format in Numbers 3?
    I'm not sure where the custom format came from in the erlier version of numbers. I guess I must have created it for something, I can't remember what.
    It now appaers that when I send a Numbers 3 document via email to an Excel format  it adds a weird custom format that turns currency into garbage. Once in Excel simply going to format cells and deleting this odd format cures the problem.
    If I could find a way of deleting it in Numbers 3, hopefully the problem will go away.
    This is far from the only problem I'm having with Numbers 3. It's begining to look like I'll have to abandon Numbers 3 having had to go to the expense of buying a new iPad because Numbers 3 documents (and presumably Pages Keynote etc) no longer work on the original iPad.

    I never promote the method the deletion unless you understand the underlying tables of planning, if you search on the forum you will see posts on the subject just like this one - Delete dimension from planning application
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Date format in Excel report output

    Goodmorning All.
    Am using XML publisher for some reports. The current report is in Excel. Everything is fine on this. I want to print the date parameter in 'MON-YY' format.
    In the 'Text Form Field' option, I have used the type as 'Regular Text'. In the 'Add Help Text' using the formatting as follows: <?format-Date:P_TO_DATE1;MM/YYYY?>. This seems to send the date parameter '1-Jun-12' as 'Jun-12'. But when it opens in excel, Excel assigns the cell 'Custom' format and type as 'd-mmm-yy' instead of 'mmm-yy'. So the final output still comes in DD-MON-YY format.
    I have tried changing the type to 'DATE' and date format to 'MMM-yy' in the 'Text Form Field' option. But still the excel custom format is overriding the final output.
    Any suggestions?
    Thanks
    Z

    Hi Alex,
    I used the following code in the 'Form field help Text': <?xdoxslt:format_date(P_FROM_DATE1,'MMM-yy','yyyy-MM-dd', 'en-us', $_XDOTIMEZONE)?>
    Then I wrote some letters immediately after that and ran the report. When I opened it in excel, Excel assigned format category as 'General' to the output cell. So the output now comes as desired format as 'Jan-12XYZ'.
    So it seems, if there will be some additional characters after the dates, then excel does not auto reformat the XML output to the custom date category.
    Now the big question; How to do it without the trailing characters i.e. 'XYZ' in the above output. If I remove them, then Excel will again try to custom format the date. I read soemwhere that blank space can be used to append but am not sure how it will be in the code.
    By the way in the 'text Form Field Options' I am using type as 'Regular Text'.
    Appreciate any help.
    Thanks
    Z

  • How to set first column as date (dd/mm/yyyy) in the specific format in excel

    hi need help wat i did need help is tht i need wen ever i send view a excel data  the first column set to date  but some times wen i view in different type of pc the date format change to mm/dd/yyyy. is  thr any way i can set the format?

    If you just need to reformat a correct date to show up as dd/mm/yyyy, just use the "Format Cells" command and set a custom format string to exactly that. If, on the other hand, you are finding that Excel just doesn't get that the first value is a DAY, not a month, such as trying to graph a temperature data logger that records data in dd/mm/yyyy:
    Reformat the strings as dd/mm/yyyy, using the first method. This will make them LOOK correct, even though the actual date VALUES are still day-month inverted. Now save the table as a .CSV file. This will save the dates as plain text in the correct order, which you can then re-import and have Excel now read the correct date value.
    Ryan R.
    R&D

  • Can cells set to custom format appear differently on different versions of MS OFFICE?

    I'm currently involved in a data enrichment project where we convert some financial data for our clients in excel. We've been facing a problem with date formats in the reports sent to us by the client. 
    We're supposed to enter 4 different dates in separate columns with 3 different formats. For example in one column the date format should appear in the dd/mm/yyyy format and in another as dd-mm-yyyy. What we've done is set all these cells to CUSTOM format
    and in the TYPE dialog in the Custom Tab typed "dd\/mm\/yyyy" where we need the date to appear as dd/mm/yyyy and "dd-mm-yyyy" where we need the date to appear as dd-mm-yyyy. 
    However, the client says that when he downloads the file on his computer he sees the date formats set to DATE and not CUSTOM. Is this possible?
    Can a cell set to CUSTOM FORMAT appear differently on a different version of MS OFFICE?
    Does the Operating System also have a role to play in this?
    For example if we've typed our data in OFFICE 2007 on a system with XP as the OS, will it not open as CUSTOM when we open it in OFFICE 2010 with Windows 7 as the OS?
    We need serious help on this as this confusion has put our project in jeopardy. 

    Thanks for the help Jim. Just to make it clearer we haven't used quotation marks in the date formats. Further, we were told to use back slash by the client cause according to them this would help in keeping the date formats as fixed to custom format on any
    computer that the file is opened on.
    What I'm trying to figure out is that if a cell is set to a custom format, can it appear differently when opened on a different computer?
    We've sent the file using Sendspace.com to our clients and when we download the file and open it on any version of MS Office we still see the custom formats in the date fileds. However, the client insists that it appears differently on their computers. 
    Is it possible for a cell set to a custom format to not appear as custom on a different computer?
    Just to remind you again that we've downloaded the file on almost every version of Office and have noticed no change in the formats set by our team. How then is it possible that the dates doesn't appear as custom formats on their system?
    I would really appreciate if you could help me solve this situation.

  • Custom formatting text?

    I some documents with custom formatting in them, for example if a sentence was:
    This should be {red}color.
    Then the world "color" should be red and the {red} should not appear.
    Now my current way of doing this it though a JTextPane.
    I do something like this (currently dont have the code with me so it may not be 100% accurate):
    // Get our temp
    String temp = this.getText ( );
    // Get our pos
    int pos = temp.indexOf ( "{red}" );
    // Set the first half
    this.setText ( temp.substring ( 0, pos ) );
    // Set the second half
    this.setText ( this.getText ( ) + temp.substring ( pos + 6, temp.length ( ) - pos - 6 );
    styledDocument.setCharacterAttributes(pos, this.getText ( ).length ( ) - pow, styledDocument.getStyle ("Red" ), false);Is their any better ways to do this?
    Can I automatically do like a
    styledDocument.addReplace ( "{red}", styledDocument.getStyle ("Red" ) ); So that it will automatically know what to replace? Thanks for any help!

    Can I automatically do like a styledDocument.addReplace ( "{red}",
    styledDocument.getStyle ("Red" ) ); So that it will automatically know what to replace? No idea what you are asking. You can write you own method to do that if you want. But the StyledDocument can't do that for you.

  • I am using a doc formatted on excel --- how do i resize the doc to fit on one page?

    I am using a document that was formatted in excel (on a PC) --- how do i resize the document to print on one page?

    Hi phylw,
    Here is one way. View > Show Print View. At the bottom of the window is a slider control called Content Scale. Slide to the left to shrink the document.
    Under File > Print... you will see a print preview that tells you how many pages the document now occupies.
    Regards,
    Ian.

  • Reading long text from excel file to an internal table

    Hi
    Can any body tell me how to read long text from excel file to an internal table.
    When i am using this FM KCD_EXCEL_OLE_TO_INT_CONVERT then it is reading only 32 characters from each cell.
    But in my excel sheet in one of the cell has very long text which i need to upload into a internal table.
    may i know which FM or what logic i need to use for this problem.
    Regards

    Hi,
    Here is an example program.  It will upload an Excel file with two columns.  You could also assign the Excel structure dynamically, but I wanted to keep the example simple.  The main point is that the internal table (it_excel in this example) must match the Excel structure that you want to convert.
    Remember, this is just an example to help you figure out how to properly use the technique.  It will certainly need to be modified to fit your requirements, and as always there may be a better way to get the Excel converted... this is just one possibility that has worked for me in the past.
    *& Report  zexcel_upload_test                            *
    REPORT  zexcel_upload_test.
    TYPE-POOLS: truxs.
    TYPES: BEGIN OF ty_excel,
             col_a(10) TYPE n,
             col_b(35) TYPE c,
           END OF ty_excel.
    DATA: l_data_tab         TYPE TABLE OF string,
          l_text_data        TYPE truxs_t_text_data,
          l_gui_filename     TYPE string,
          it_excel           TYPE TABLE OF ty_excel.
    FIELD-SYMBOLS: <wa_excel>  TYPE ty_excel.
    PARAMETERS: p_file TYPE rlgrap-filename.
    * Pass the file name in the correct format
    l_gui_filename = p_file.
    * Upload data from PC
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename                = l_gui_filename
        filetype                = 'ASC'
        has_field_separator     = 'X'
      CHANGING
        data_tab                = l_data_tab
      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 ...
      EXIT.
    ENDIF.
    * Convert from Excel into the appropriate itab
    l_text_data[] = l_data_tab[].
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
      EXPORTING
        i_field_seperator    = 'X'
        i_tab_raw_data       = l_text_data
        i_filename           = p_file
      TABLES
        i_tab_converted_data = it_excel
      EXCEPTIONS
        conversion_failed    = 1
        OTHERS               = 2.
    IF sy-subrc <> 0.
    *   MESSAGE ...
      EXIT.
    ENDIF.
    LOOP AT it_excel ASSIGNING <wa_excel>.
    *  Do something here...
    ENDLOOP.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      PERFORM filename_get CHANGING p_file.
    *       FORM filename_get                                             *
    FORM filename_get CHANGING p_in_file TYPE rlgrap-filename.
      DATA: l_in_file  TYPE string,
            l_filetab  TYPE filetable,
            wa_filetab TYPE LINE OF filetable,
            l_rc       TYPE i,
            l_action   TYPE i,
            l_init_dir TYPE string.
    * Set the initial directory to whatever you want it to be
      l_init_dir = 'C:\'.
    * Call the file open dialog without multiselect
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title            = 'Load file'
          default_extension       = '.XLS'
          default_filename        = l_in_file
          initial_directory       = l_init_dir
          multiselection          = 'X'
        CHANGING
          file_table              = l_filetab
          rc                      = l_rc
          user_action             = l_action
        EXCEPTIONS
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          OTHERS                  = 4.
      IF sy-subrc <> 0.
        REFRESH l_filetab.
      ENDIF.
    * Read the selected filename
      READ TABLE l_filetab INTO wa_filetab INDEX 1.
      IF sy-subrc = 0.
        p_in_file = wa_filetab-filename.
      ENDIF.
    ENDFORM.                    " filename_get
    Regards,
    Jamie

  • Change in report format after exporting from pdf format to excel format.

    Hi,
    I got a problem while exporting the pdf format of the Report to Excel format "Fully-Foramtted Grids and Texts".
    The format gets automatically changed.
    Is there any solution to this problem.

    Can you give some more details?
    Which version are you using (and which patch level - if any).
    Also what formatting is default on the reports and what is the default format in excel.
    What exactly is different between PDF and excel?
    Another possibility is that font substitution is going on??

  • "Unable to read file" error in Excel 2010 when downloading .xls file from IE11

    We have lots of reports that have links for our users to be able to download report results in Excel format. We accomplish this by using the Excel mime type in our .asp pages. Sporadically, we are seeing "Unable to read file" errors in Excel 2010
    after choosing Open from the IE11 save dialog. Choosing Save/Save As and the file will open just fine.
    Also, we can sometimes cause the error to occur more frequently by switching windows during the time when the file is downloading.
    If the file is opened directly from /Temporary Internet Files then it opens just fine.
    Window 7 64-bit
    Thanks in advance!

    Hi,
    I found you replied in a similar thread, did you try the workaround (Reset the IE) that provided there? Did you change a browser to test?
    Then, I suggest we use Process Monitor to do further troubleshooting. Please collect all the actions of IE.exe and Excel.exe, and check the if there are some
    error message/code during you open XLS file from IE 11.
    Hope it's helpful.
    Regards,
    George Zhao
    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.

Maybe you are looking for