Forum Discussion

andrew_1's avatar
andrew_1
Occasional Contributor
12 years ago

Can't get Testcomplete to read some Excel cells

Hi Team



I have a problem with TC (version 9) not reading certain entries in an Excel (2010) spread sheet used for data driven tests. The problem happens when there is mixed text and numbers in a column. For example, I have a column that has mostly numbers and occasionally numbers with a text prefix i.e. 654321, 987654, tst321, 456789 . . . The entries with only numbers will be used when tests are run, but entries with both numbers and text will cause an error. When using View Sheet under Select Worksheet in the Data Driven Loop dialog to view the sheet, TC shows the cells with mixed numbers and text as empty.



The bizarre thing is, this wasn’t happening when I had the 64 bit version of Excel installed. I uninstalled the 64 bit version because TC couldn’t read from a spread sheet unless it was open.



Any help resolving this will be much appreciated.

4 Replies

  • joffre's avatar
    joffre
    Regular Contributor
    Hello Andrew.



    Could you please show us what error is being returned?



    Here we use DDT with ADO Objects, but I have used Excel either. All I can do to help is show how we worked with sheets:





    function login()

    {

      try {

        Log.Message("Load the sheet");

        sheet = DDT.ExcelDriver("C:\\Importa_Tabelas\\BeWeb.xlsx", "Login", true);

      } catch (exception) {

        Log.Error("Something wrong hapenned - " + exception.description + ". Check the sheet's path.");

        Runner.Stop();

      }



      Log.Message("Select the string connection");

      CboConn.ClickItem(sheet.Value(0));

      Sys.Browser().Page("*").Wait();

      Log.Message("Set the login");

      TxtLogin.SetText(sheet.Value(1));

      Log.Message("Set the password");

      TxtPassword.SetText(sheet.Value(2));

      Log.Message("Click enter");

      BtnLogin.ClickButton();

      Sys.Browser().Page("*").Wait();

    }


  • andrew_1's avatar
    andrew_1
    Occasional Contributor
    Problem Solved



    The column causing the problem in Excel was formated as General. Changing the format to Text has solved the problem. It's strange how this wasn't an issue in the 64 bit version of Excel.



    Thanks Joffre for taking the time to respond to my post.
  • andrew_1's avatar
    andrew_1
    Occasional Contributor
    Thanks for your response Joffre. I should point out that I have no development experience and little scripting knowledge. Up until a few months ago, I worked in a completely different field and was a super-user for the software I am now testing. If scripting is part of the solution, I might need to ask some more questions.



    The test stops on an exception and the Additional Info indicates a Type Mismatch. The screenshots show the data as it is in the spread sheet and how it is displayed using the View Sheet in the Data Driven Loop dialog.