Read lines from second sheet from an excel

i have an excel file with two tab sheets.
i use this code but it doesnt work correctly. actually it works but for the first tabsheet.
i want it for the second one only. please help. i wiil reward with points in helpfull answers.
  call method of application 'Worksheets' = sheet
    exporting
      #1 = 2.
  set property of sheet 'Name' = 'Timesheets'.
  call method of sheet 'Activate'.
CALL METHOD OF gs_chart 'Location'
   EXPORTING
     #1 = 2
     #2 = 'Timesheets'.
  call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    exporting
      filename                = p_file
      i_begin_col             = 1
      i_begin_row             = 7
      i_end_col               = 1
      i_end_row               = 60000
    tables
      intern                  = itemp
    exceptions
      inconsistent_parameters = 1
      upload_ole              = 2
      others                  = 3.
  if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.
  clear w_itemp.
  loop at itemp.
    w_itemp = itemp.
    at last.
      w_lin = w_itemp-row.
    endat.
  endloop.

Hi See following link :
http://searchsap.techtarget.com/tip/1,289483,sid21_gci868246,00.html?FromTaxonomy=/pr/283958
Reward points if helpful.
Regards.
Srikanta Gope

Similar Messages

  • GUI_UPLOAD to read data from an Excel File

    Hi Folks,
    I'm using FM GUI_UPLOAD to read data from an Excel File. But all I see in the table returned is 1 row with garbage values (special chacaters). Excel Workbook has proper data in the sheet, but its not getting uploaded properly. Sy-subrc is 0.
    What could be the reason?
    Thanks

    use FM : ALSM_EXCEL_TO_INTERNAL_TABLE
    See the example program to get from XLS file to Internal table
    REPORT ZLWMI151_UPLOAD no standard page heading
                           line-size 100 line-count 60.
    *tables : zbatch_cross_ref.
    data : begin of t_text occurs 0,
           werks(4) type c,
           cmatnr(15) type c,
           srlno(12) type n,
           matnr(7) type n,
           charg(10) type n,
           end of t_text.
    data: begin of t_zbatch occurs 0,
          werks like zbatch_cross_ref-werks,
          cmatnr like zbatch_cross_ref-cmatnr,
          srlno like zbatch_cross_ref-srlno,
          matnr like zbatch_cross_ref-matnr,
          charg like zbatch_cross_ref-charg,
          end of t_zbatch.
    data : g_repid like sy-repid,
           g_line like sy-index,
           g_line1 like sy-index,
           $v_start_col         type i value '1',
           $v_start_row         type i value '2',
           $v_end_col           type i value '256',
           $v_end_row           type i value '65536',
           gd_currentrow type i.
    data: itab like alsmex_tabline occurs 0 with header line.
    data : t_final like zbatch_cross_ref occurs 0 with header line.
    selection-screen : begin of block blk with frame title text.
    parameters : p_file like rlgrap-filename obligatory.
    selection-screen : end of block blk.
    initialization.
      g_repid = sy-repid.
    at selection-screen on value-request for p_file.
      CALL FUNCTION 'F4_FILENAME'
           EXPORTING
                PROGRAM_NAME = g_repid
           IMPORTING
                FILE_NAME    = p_file.
    start-of-selection.
    Uploading the data into Internal Table
      perform upload_data.
      perform modify_table.
    top-of-page.
      CALL FUNCTION 'Z_HEADER'
      EXPORTING
        FLEX_TEXT1       =
        FLEX_TEXT2       =
        FLEX_TEXT3       =
    *&      Form  upload_data
          text
    FORM upload_data.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                FILENAME                = p_file
                I_BEGIN_COL             = $v_start_col
                I_BEGIN_ROW             = $v_start_row
                I_END_COL               = $v_end_col
                I_END_ROW               = $v_end_row
           TABLES
                INTERN                  = itab
           EXCEPTIONS
                INCONSISTENT_PARAMETERS = 1
                UPLOAD_OLE              = 2
                OTHERS                  = 3.
      IF SY-SUBRC <> 0.
        write:/10 'File '.
      ENDIF.
      if sy-subrc eq 0.
        read table itab index 1.
        gd_currentrow = itab-row.
        loop at itab.
          if itab-row ne gd_currentrow.
            append t_text.
            clear t_text.
            gd_currentrow = itab-row.
          endif.
          case itab-col.
            when '0001'.
              t_text-werks = itab-value.
            when '0002'.
              t_text-cmatnr = itab-value.
            when '0003'.
              t_text-srlno = itab-value.
            when '0004'.
              t_text-matnr = itab-value.
            when '0005'.
              t_text-charg = itab-value.
          endcase.
        endloop.
      endif.
      append t_text.
    ENDFORM.                    " upload_data
    *&      Form  modify_table
          Modify the table ZBATCH_CROSS_REF
    FORM modify_table.
      loop at t_text.
        t_final-werks = t_text-werks.
        t_final-cmatnr = t_text-cmatnr.
        t_final-srlno = t_text-srlno.
        t_final-matnr = t_text-matnr.
        t_final-charg = t_text-charg.
        t_final-erdat = sy-datum.
        t_final-erzet = sy-uzeit.
        t_final-ernam = sy-uname.
        t_final-rstat = 'U'.
        append t_final.
        clear t_final.
      endloop.
      delete t_final where werks = ''.
      describe table t_final lines g_line.
      sort t_final by werks cmatnr srlno.
    Deleting the Duplicate Records
      perform select_data.
      describe table t_final lines g_line1.
      modify zbatch_cross_ref from table t_final.
      if sy-subrc ne 0.
        write:/ 'Updation failed'.
      else.
        Skip 1.
        Write:/12 'Updation has been Completed Sucessfully'.
        skip 1.
        Write:/12 'Records in file ',42 g_line .
        write:/12 'Updated records in Table',42 g_line1.
      endif.
      delete from zbatch_cross_ref where werks = ''.
    ENDFORM.                    " modify_table
    *&      Form  select_data
          Deleting the duplicate records
    FORM select_data.
      select werks
             cmatnr
             srlno from zbatch_cross_ref
             into table t_zbatch for all entries in t_final
             where werks = t_final-werks
             and  cmatnr = t_final-cmatnr
             and srlno = t_final-srlno.
      sort t_zbatch by werks cmatnr srlno.
      loop at t_zbatch.
        read table t_final with key werks = t_zbatch-werks
                                    cmatnr = t_zbatch-cmatnr
                                    srlno = t_zbatch-srlno.
        if sy-subrc eq 0.
          delete table t_final .
        endif.
        clear: t_zbatch,
               t_final.
      endloop.
    ENDFORM.                    " select_data

  • Help! How to read data from an Excel file?

    Hi,
    I need to read data from an Excel file that may contain more then one table in a sheet. How can I read them?
    I would be eternally grateful to anyone who can give me any information.

    Did you try POI from Apache?
    http://jakarta.apache.org/poi/index.html

  • Reading data froma an excel

    Hi all,
               I want to read data froma an excel sheet.
    The code i used to read the data is
    IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(IPrivateFileUplaodView.IContextElement.FILE_RESOURCE);
    *     IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) attributeInfo.getModifiableSimpleType();*
    *                    IContextElement element = wdContext.currentContextElement();*
    *                    if(element.getFileResource()!= null)*
    *                      try*
    *                            String mimeType = binary.getMimeType().getFileExtension();*
    *                            wdComponentAPI.getMessageManager().reportSuccess("File " + binaryType.getFileName() + " has been successfuly uploaded ! ");*
    *                      catch(Exception e)*
    *                            throw new WDRuntimeException(e);*
    *                    else*
    *                         wdComponentAPI.getMessageManager().reportException("File could not be uploaded", true);*
    *                    // Till here the code remains the same as in File Upload tutorials*
    *                    // Now the code for retrieving the values from the Excel sheet*
    *                    try*
    *                       ByteArrayInputStream bais = new ByteArrayInputStream(element.getFileResource());*
    *                       Workbook workbook = Workbook.getWorkbook(bais);*
    *                       Sheet sheet = workbook.getSheet(0);*
    *                       Cell a1 = sheet.getCell(0,0);*
    *                       Cell a2 = sheet.getCell(0,1);*
    *                       wdComponentAPI.getMessageManager().reportSuccess("Value of cell a1 = " + a1.getContents());*
    *                       wdComponentAPI.getMessageManager().reportSuccess("Value of cell a2 = " + a2.getContents());*
    *                    catch(Exception ex)*
    *                      wdComponentAPI.getMessageManager().reportException(ex.getLocalizedMessage(),true);*
    But i am getting error at "binary" in  String mimeType = binary.getMimeType().getFileExtension();
    and ByteArrayInputStream bais = new ByteArrayInputStream(element.getFileResource()); by saying that there is no constructor of
    ByteArrayInputStream with Resource as parameter.
    Please let me know what might be the issue so that i can solve this.
    Thanks and regards,
    Chandrashekar.

    Hi,
    Replace the following code
    ByteArrayInputStream bais = new ByteArrayInputStream(element.getFileResource());*
    with
    IWDResource resource = element.getFileResource();
           InputStream inputStream = resource.read(false);
           ByteArrayInputStream bais = new ByteArrayInputStream(inputStream);
    Regards
    Ayyapparaj

  • Reading data from an excel file

    Hi,
    I want to read data from the excel file and display it in
    jsp page. Iam getting the following error:
    [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con =
    DriverManager.getConnection("jdbc:odbc:mydsn","","");
    Statement st = con.createStatement();
    ResultSet rs = st.executeQuery("select * from [holidays$]");
    Here i have created the dsn with the name "mydsn". I have the
    following data in the mydsn.dsn file:
    [ODBC]
    DRIVER=Microsoft Excel Driver (*.xls)
    UID=admin
    UserCommitSync=Yes
    Threads=3
    SafeTransactions=0
    ReadOnly=1
    PageTimeout=5
    MaxScanRows=8
    MaxBufferSize=2048
    FIL=excel 8.0
    DriverId=790
    DefaultDir=D:\WorkSpace\Projects\VINET\devl\webroot\jsp
    DBQ=D:\WorkSpace\Projects\VINET\devl\webroot\jsp\list_of_holidays_2003.xls
    thanks in advance
    phani.

    You might want to look at the POI project (an open source Jakarta sub-project) that allows you to create/modify/read excel files via Java code. That might be more flexible and easier than what you're currently trying to do.
    Cheers

  • Read lines from text file to java prog

    how can I read lines from input file to java prog ?
    I need to read from input text file, line after line
    10x !

    If you search in THIS forum with e.g. read lines from file, you will find answers like this one:
    Hi ! This is the answer for your query. This program prints as the output itself reading line by line.......
    import java.io.*;
    public class readfromfile
    public static void main(String a[])
    if you search in THIS forum, with e.g. read lines from text file
    try{
    BufferedReader br = new BufferedReader(new FileReader(new File("readfromfile.java")));
    while(br.readLine() != null)
    System.out.println(" line read :"+br.readLine());
    }catch(Exception e)
    e.printStackTrace();
    }

  • I want to read lines from file, count it and extract numbers from a first line.

    i must do un loop?

    HI,
    i try to explain how to use to LABVIEW TOOLS...
    1. USE a for next loop
    2. here you must open the file with the VI. read lines from file.
    you can choos how many lines you read at same time.
    3. the string you can convert into an number.
    4. in the loop is the literal counter... this is you line couter....
    iun schrieb:
    > i must do un loop?

  • How to populate the data to second sheet tab in excel

    Hai,
    I need to populate data to the second sheet tab of excel sheet .
    Below is the code wherein I added datas to first sheet of the excel sheet.Can anyone help me in this ?
    <%
    response.setHeader("Cache-Control","max-age=0"); // HTTP 1.1
    response.setHeader("Pragma","public"); // HTTP 1.0
    response.setDateHeader ("Expires", 0); // prevents caching at the proxy server
    response.setContentType("application/ms-excel;charset=UTF-8");
    response.setHeader("Content-Disposition","attachment;filename=Test.xls");
    %>
    <html xmlns:v="urn:schemas-microsoft-com:vml"
    xmlns:o="urn:schemas-microsoft-com:office:office"
    xmlns:x="urn:schemas-microsoft-com:office:excel"
    xmlns="http://www.w3.org/TR/REC-html40">
    <xml>     
    <x:ExcelWorkbook>
    <x:ExcelWorksheets>
    <x:ExcelWorksheet>
              <x:Name>Sheet-1</x:Name>
    <x:WorksheetOptions>
    </x:WorksheetOptions>
         </x:ExcelWorksheet>
         <x:ExcelWorksheet>
              <x:Name>Sheet-2</x:Name>
         <x:WorksheetOptions>
         </x:WorksheetOptions>
    </x:ExcelWorksheet>
    </x:ExcelWorksheets>
    <x:WindowHeight>9090</x:WindowHeight>
    <x:WindowWidth>15180</x:WindowWidth>
    <x:WindowTopX>120</x:WindowTopX>
    <x:WindowTopY>15</x:WindowTopY>
    <x:ProtectStructure>False</x:ProtectStructure>
    <x:ProtectWindows>False</x:ProtectWindows>
    </x:ExcelWorkbook>
    </xml>
    <body link=blue vlink=purple>
    <table x:str border=0 cellpadding=0 cellspacing=0 width=192 style='border-collapse:collapse;table-layout:fixed;width:144pt'>
    <tr height=17 style='height:12.75pt'>
    <td height=17 align=right >HELLO</td>
    <td align=right >HI</td>
    <td align=right >GOOD BYE</td>
    </tr>
    </table>
    </body>
    </html>

    Hi,
    It's been a while since I did this stuff so I apologise if my advice is out of date.
    This is actually more of a Micro$oft question as this is their propriety SpreadSheet Markup Language so POI probably won't help. Also, you might want to look at using the default namespace of "urn:schemas-microsoft-com:office:spreadsheet" as this is the more current implementation unless you need to be backward compatible.
    On your specific question, I think that you should be able to put the table tag (SSML not HTML) inside the worksheet and then create the rows and cells in there. I've never tried mixing the 2 markup languages though so I'm not sure how to get the HTML to go into the correct sheet.
    Sorry I couldn't help more :-(

  • Read lines from a file

    With "ApartmentFileHandler" I can write Apartment-objects to a file and read them from a file.
    To write I loop through each room in the apartment and write its size
    and type. I put 1 Room per line.
    To read I read each line of the file and recreate the room stored
    there. When there are no lines left in the file I pass the Rooms from
    the file to the Apartment constructor and return the new Apartment.
    Only one Apartment is stored in each file. (Apartment doesn?t implement
    Serializable, so I cant write straight Apartment-objects to a file.)
    So in the file, there are stored one "Room" per line: String type,
    double size
    QUESTION: How am I able to read all lines: first line first -> make a new room of
    it, and store to a roomArray? Then second -> do same as I did to the
    first.
    Now my read()-method doesn't read all lines. How to change it to read next line?
    Thanks in advance.
    public class Room extends Space
    public Room(String type, double area)
    public String getType()
    public double getSize()
    public class Apartment extends Space
    public static final String KITCHEN
    public Apartment(Room[] rooms)
    public String getType()
    public double getSize()
    public Room[] getRooms()
    public class ApartmentFileHandler extends Object {
         private FileOutputStream ostream;
         private ObjectOutputStream op;
         private FileInputStream istream;
         private ObjectInputStream ip;
         private String filepath;
    public ApartmentFileHandler (String filepath) {
                              this.filepath = filepath;      
    public Apartment read()
                                      throws InvalidApartmentFile,
                                                 IOException {
          istream = new FileInputStream(filepath);
          ip = new ObjectInputStream(istream);
                                  // count how many rows in the file ie. rooms
                           String lineThatIsRead = ip.readLine();
                           int count =0;                                             
                           while (lineThatIsRead != null) {
                                    count =count +1;
                                    lineThatIsRead =ip.readLine();
         Room room;
         Room roomArray[ ] = new Room[count];
          for(int i =0; i<count; i++) {
                                  String type  =ip.readUTF();
              double size =ip.readDouble();
                                   room =new Room(type, size);
              roomArray[ i ] =room;
                                Apartment apartment = new Apartment(roomArray);
                                return apartment;
            public void write(Apartment apartment)
                  throws IOException {
                    ostream = new FileOutputStream(filepath);
                    op = new ObjectOutputStream(ostream);
                    int numberOfRooms =apartment.getRooms().length;
                    Room[] allRooms =apartment.getRooms();
                    for (int i=0; i< numberOfRooms; i++) {
                         op.writeUTF( allRooms[ i ].getType() );
                         op.writeDouble( allRooms[ i ].getSize() );
                         op.writeChars("\n");

    Hi,
    I recommend using java.io.BufferedReader in conjunction with java.io.FileReader:
    BufferedReader reader=new BufferedReader(new FileReader(filepath));
    java.io.BufferedReader provides the method public java.lang.String readLine() throws java.io.IOException which lets you read a complete line from the underlying java.io.Reader object. Furthermore, BufferedReader will - as the name implies - buffer your IO-operations which will help you improve the program's performance. In order to read all the lines contained in a text file you might want to apply a loop:
    String line;
    while((line=reader.readLine())!=null && line.length()!=0){
    //process data in string line (parse into string and double)
    Of course, everything must be contained within a try-catch-block in order to be able to handle upcoming IOException objects.
    Regards,
    Michael

  • How to read data from the excel file using java code.

    Hi to all,
    I am using below code to getting the data from the excel file but I can't get the corresponding data from the specific file. can anyone give me the correct code to do that... I will waiting for your usefull reply......
    advance thanks....
    import java.io.*;
    import java.sql.*;
        public class sample{
                 public static void main(String[] args){
                      Connection connection = null;
                          try{
                               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                               Connection con = DriverManager.getConnection( "jdbc:odbc:Mydsn","","" );
                               Statement st = con.createStatement();
                               ResultSet rs = st.executeQuery( "Select * from [Sheet1$]" );
                               System.out.println("sample:"+rs);
                                  ResultSetMetaData rsmd = rs.getMetaData();
                                  System.out.println("samplersd:"+rsmd);
                               int numberOfColumns = rsmd.getColumnCount();
                                  System.out.println("numberOfColumns:"+numberOfColumns);
                                   while (rs.next()) {
                                            System.out.println("sample1:"+rs);
                                            for (int i = 1; i <= numberOfColumns; i++) {
                                                 if (i > 1) System.out.print(", ");
                                                 String columnValue = rs.getString(i);
                                                 System.out.print(columnValue);
                                            System.out.println("");
                                       st.close();
                                       con.close();
                                      } catch(Exception ex) {
                                           System.err.print("Exception: ");
                                           System.err.println(ex.getMessage());
                        }

    1: What is the name of the excel sheet?
    2: What is printed in this program? null ? anything?
    error?Excel file name is "sample.xls" I set excel file connectivity in my JDBC driver(DSN). Here in my program I am not giving that excel file name. I am giving only that excel sheet name. that is followed
    ResultSet rs = st.executeQuery( "Select * from [Sheet1$]" );The output of this program is given bellow.
    sample:sun.jdbc.odbc.JdbcOdbcResultSet@1b67f74
    samplersd:sun.jdbc.odbc.JdbcOdbcResultSetMetaData@530daa
    numberOfColumns:2

  • How to read data from a excel and HTML file

    Hi
        I am writing an 2D-array of string into Excel/HTML file using Report generation.
        Can anybody tell me how to retrieve back the written data from the same files again and view in array format.
    Thanks & regards
    Visuman 
    Solved!
    Go to Solution.

    you can use activex to read the data from the excel fileback in the array format...go through this vi...may b this will help you.........
    Attachments:
    Read Excel-1.vi ‏32 KB

  • Read lines from more than 1 file of different file extensions, extract the data and output to screen

    Hi,
    I am trying to read data from more than one file at once. The files are different types e.g. one is a text file one is an xml file like so, StudentInformation.txt, CollegeInformation.xml. The files are all stored in one place, in this case on the D drive of
    a local computer. I am trying to locate any files in the D drive with a file extension of .txt or of .xml (there may be more than two of these files in the future, so I'm trying to allow for that). Then I want to open all of these files, extract the information
    and output all the information in one display window. I want all the information from these two or more files to be displayed together in the display window.
    Here is the code so far. It is throwing up errors.
            //Load from txt or xml files
            private void btnLoad_Click(object sender, RoutedEventArgs e)
                    IEnumerable<string> fileContents = Directory.EnumerateFiles("D:\\", "*.*", SearchOption.TopDirectoryOnly)
                    .Select(x => new FileInfo(x))
                    .Where(x => x.Extension == ".xml" || x.Extension == ".txt")
                    .Select(file => ParseFile(file));}
                    private string ParseFile(FileInfo file)
                        try
                            using (StreamReader sr = new StreamReader(file.FullName))
                                string line;
                                while ((line = sr.ReadLine()) != null)
                                    //Logic here to determine if this is the correct file and append accordingly
                                    lbDisplay.Items.Add(line);
                                return line;
                        catch (Exception ex)
                            // Let the user know what went wrong
                            MessageBox.Show("The file could not be read: ");
                            MessageBox.Show(ex.Message);
    The error it throws up is:
    Error 1
    'BookList.MainWindow.ParseFile(System.IO.FileInfo)': not all code paths return a value

    This is the Small Basic programming language so moving to a C# forum.
    But you need all paths to return a value, including if an exception is called and it jumps to the catch, perhaps just:
    // Let the user know what went wrong
    MessageBox.Show("The file could not be read: ");
    MessageBox.Show(ex.Message);
    return "";

  • Read Lines from, JTextArea

    Hi there,
    I'm trying to save the text from a JTextArea as a file. It all work fine, except the file is written as on long string. Is there any way around this? I was going to read the text line by line, add it to a Vector and then write the file from the Vector, but how do u read just on line from a JTextArea.
    All I can find is .getText - but that dosn't do the trick.
    ANy suggestions Dukes?

    well, yes but the problem is:
    I load one .txt file (or similar) into the JTextArea, then u change it round a bit and click on save.
    This is when the .getText method comes into play, unfortunately it seems to read the whole area as one string (where line-breaks appears as little black squares).
    Is it possibly the FileOutput sequence that's the problem?
    (there's no "\n" in the loaded text)

  • Reading data from multiple excel sheets

    hi all
    i have to read the data from excel file's sheet1 and sheet3. how can i do this using forms6i
    thanks.

    Dear Rehman,
    Use This Code ,it is very useful to read the data from excel file's sheet1 and sheet2 and so on.here i written the code for sheet1 and sheet2 only.if u need sheet3 .. and extra make a code based on sheet1 or sheet2.
    Regards
    Gopinath M
    DECLARE
    --Declare handles to OLE objects
    application ole2.obj_type;
    workbooks ole2.obj_type;
    workbook ole2.obj_type;
    worksheet ole2.obj_type;
    cell ole2.obj_type;
    --Declare handles to OLE argument lists
    args ole2.list_type;
    Check_file text_io.file_type;
    no_file exception;
    PRAGMA exception_INIT (no_file, -302000);
    cell_value varchar2(2000);
    BEGIN
    --Check the file can be found, if not exception no_file will be raised
    Check_file := TEXT_IO.FOPEN('L:\Individual Person Folders\Gopi\test1.XLS','R');
    TEXT_IO.FCLOSE(Check_file);
    application:= ole2.create_obj('Excel.Application');
    workbooks := ole2.get_obj_property(application, 'Workbooks');
    --Open the required workbook
    args:= ole2.create_arglist;
    ole2.add_arg(args, 'L:\Individual Person Folders\Gopi\test1.XLS');
    workbook := ole2.invoke_obj(workbooks, 'Open', args);
    ole2.destroy_arglist(args);
    --Open worksheet Sheet1 of that Workbook
    args:= ole2.create_arglist;
    ole2.add_arg(args, 'Sheet1');
    worksheet := ole2.get_obj_property(workbook, 'Worksheets', args);
    ole2.destroy_arglist(args);
    --Get value of cell A1 of worksheet Sheet1
         args:= ole2.create_arglist;
    ole2.add_arg(args, 1);
    ole2.add_arg(args, 1);
    cell:= ole2.get_obj_property(worksheet, 'Cells', args);
         ole2.destroy_arglist(args);
         cell_value :=ole2.get_char_property(cell, 'Value');
         message(cell_value);          
    args:= ole2.create_arglist;
    ole2.add_arg(args, 1);
    ole2.add_arg(args, 2);
    cell:= ole2.get_obj_property(worksheet, 'Cells', args);
    ole2.destroy_arglist(args);
    cell_value :=ole2.get_char_property(cell, 'Value');
    message(cell_value);
    args:= ole2.create_arglist;
    ole2.add_arg(args, 1);
    ole2.add_arg(args, 3);
    cell:= ole2.get_obj_property(worksheet, 'Cells', args);
    ole2.destroy_arglist(args);
    cell_value :=ole2.get_char_property(cell, 'Value');
    message(cell_value);MESSAGE(' ');
    args:= ole2.create_arglist;
    ole2.add_arg(args, 'Sheet2');
    worksheet := ole2.get_obj_property(workbook, 'Worksheets', args);
    ole2.destroy_arglist(args);
    --Get value of cell A1 of worksheet Sheet1
    args:= ole2.create_arglist;
    ole2.add_arg(args, 1);
    ole2.add_arg(args, 1);
    cell:= ole2.get_obj_property(worksheet, 'Cells', args);
         ole2.destroy_arglist(args);
         cell_value :=ole2.get_char_property(cell, 'Value');
         message(cell_value);
         args:= ole2.create_arglist;
         ole2.add_arg(args, 1);
         ole2.add_arg(args, 2);
         cell:= ole2.get_obj_property(worksheet, 'Cells', args);
         ole2.destroy_arglist(args);
         cell_value :=ole2.get_char_property(cell, 'Value');
         message(cell_value);
         args:= ole2.create_arglist;
         ole2.add_arg(args, 1);
         ole2.add_arg(args, 3);
         cell:= ole2.get_obj_property(worksheet, 'Cells', args);
         ole2.destroy_arglist(args);
         cell_value :=ole2.get_char_property(cell, 'Value');
         message(cell_value);
         MESSAGE(' ');
    ole2.invoke(application,'Quit');
    --Release the OLE2 object handles
    ole2.release_obj(cell);     
    ole2.release_obj(worksheet);
    ole2.release_obj(workbook);
    ole2.release_obj(workbooks);
    ole2.release_obj(application);
    EXCEPTION
    WHEN no_file THEN
    MESSAGE('file not found.');
    WHEN OTHERS THEN
    MESSAGE(sqlerrm);
    PAUSE;
    FOR i IN 1 .. tool_err.nerrors LOOP
    MESSAGE(tool_err.message);
    PAUSE;
    tool_err.pop;
    END LOOP;
    END;

  • Unable to read data from an excel document of 365*24 values ( all rounded to 4 decimal points)

    I have an excel sheet containing data of hourly loads in MW( rounded to 4 decimals) of one year.  So, I have 365*24 values that I want to import to Labview using Read from spreadsheet.vi. However what i get in the output array is 0's and randomly some unit values at very few places. I have checked the array size of the output array and it shows different array sizes for different yearly data.
    I am attaching the four excel spreadsheets .
    Plz help me with the issue I am facing.
    Attachments:
    Load-2012.xlsx ‏95 KB
    Load-2013.xlsx ‏94 KB
    Load-2014.xlsx ‏59 KB

    If you are using LabVIEW 2014, it includes the Report Generation Toolkit (which is also available as an add-on in earlier LabVIEW Versions).  This can read native Excel files, including .xlsx.  With a few functions (3 or 4, I think), you should be able to get the entire Table into a 2D array.
    Bob Schor

Maybe you are looking for

  • HT4623 I am trying to update my iPhone 5 and keep getting an error message saying the update failed.

    I went to my iTunes on my computer to update it that way and iTunes does not show the new update.

  • Data recovery options if drive not accessible through Target Disk Mode

    I have the classic data recovery question: my computer seems to have failed, and I'd like to save some data. Thanks in advance for any advice. Details: - Most recent backup was about a month ago to Time Machine (unfortunately, this laptop went off on

  • Address Matching Using Oracle Text

    Hi, I am a newbie to Oracle Text. Hence please pardon my ignorance if this is a "RTFM" Query. We would like to clash our customer addresses against a table (GEO) that has addresses and geographic coordinates (latitude, longitude etc). The customer ad

  • Photoshop or PSE on Macbook?

    I'm trying to get an unambiguous answer to this question. I want to upgrade to a MacBook Core 2 & use a cinema display on my desktop. 2 Apple employees have told me that I can't use Photoshop at all on a Macbook (integrated video card, etc.) and they

  • N900 Bluetooth trouble with Peltor WS4

    My Peltor WS4 headset has a strange problem, when connected to my Nokia N900. Periodically it shuts of normal communication and a humming noise appears until I touch the volume button, then the unit returns to normal state for a while,, ( 30-60 sec)