Reading data from excel in selenium C#2019 Community Moderator ElectionHow do I calculate someone's age in C#?What is the difference between String and string in C#?Hidden Features of C#?Cast int to enum in C#How to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?What are the correct version numbers for C#?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?Get int value from enum in C#An exception in reading data from excel using C# selenium web driverHow to get datagridview1 to split as two or three in current excel sheet

Are there other characters in the Star Wars universe who had damaged bodies and needed to wear an outfit like Darth Vader?

Learning to quickly identify valid fingering for piano?

Practical reasons to have both a large police force and bounty hunting network?

Why do phishing e-mails use faked e-mail addresses instead of the real one?

“I had a flat in the centre of town, but I didn’t like living there, so …”

What is the meaning of option 'by' in TikZ Intersections

Why doesn't "adolescent" take any articles in "listen to adolescent agonising"?

New invention compresses matter to produce energy? or other items? (Short Story)

Convert an array of objects to array of the objects' values

If nine coins are tossed, what is the probability that the number of heads is even?

What does "rhumatis" mean?

Problems with rounding giving too many digits

Can a space-faring robot still function over a billion years?

The need of reserving one's ability in job interviews

Do natural melee weapons (from racial traits) trigger Improved Divine Smite?

Does the in-code argument passing conventions used on PDP-11's have a name?

Is divide-by-zero a security vulnerability?

Why is there an extra space when I type "ls" on the Desktop?

Was it really inappropriate to write a pull request for the company I interviewed with?

PTiJ: How should animals pray?

Why would the IRS ask for birth certificates or even audit a small tax return?

I've given my players a lot of magic items. Is it reasonable for me to give them harder encounters?

Naming Characters after Friends/Family

Computing the volume of a simplex-like object with constraints



Reading data from excel in selenium C#



2019 Community Moderator ElectionHow do I calculate someone's age in C#?What is the difference between String and string in C#?Hidden Features of C#?Cast int to enum in C#How to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?What are the correct version numbers for C#?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?Get int value from enum in C#An exception in reading data from excel using C# selenium web driverHow to get datagridview1 to split as two or three in current excel sheet










0















I'm trying to read username and password from excel sheet while using Selenium in C# .NET. Below is the code:



using excel = Microsoft.Office.Interop.Excel;

public void TestMethod1()

excel.Application xlApp = new excel.Application();
excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"D:TestTestData.xlsx");
excel._Worksheet xlWorksheet = **xlWorkbook.Sheets[1];**
excel.Range xlRange = xlWorksheet.UsedRange;



I'm getting the following error at the text that is marked in bold in above code:




Error CS0656 Missing compiler required member
'Microsoft.CSharp.RuntimeBinder.Binder.Convert' Read Data From
Excel_Office c:userstabish.khandocumentsvisual studio
2015ProjectsRead Data From Excel_OfficeRead Data From
Excel_OfficeOfficeReadExcel.cs 18 Active




Please help me resolve this issue.










share|improve this question
























  • Did you google the error message? What did you find? What did you try to fix it?

    – JeffC
    Mar 20 '17 at 16:24











  • @Mark, yes I tried googling the error. None of the solutions worked. One of the solutions asked me to add the Microsoft.CSharp.dll file. This too didn't work.

    – Tabish Khan
    Mar 20 '17 at 16:32
















0















I'm trying to read username and password from excel sheet while using Selenium in C# .NET. Below is the code:



using excel = Microsoft.Office.Interop.Excel;

public void TestMethod1()

excel.Application xlApp = new excel.Application();
excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"D:TestTestData.xlsx");
excel._Worksheet xlWorksheet = **xlWorkbook.Sheets[1];**
excel.Range xlRange = xlWorksheet.UsedRange;



I'm getting the following error at the text that is marked in bold in above code:




Error CS0656 Missing compiler required member
'Microsoft.CSharp.RuntimeBinder.Binder.Convert' Read Data From
Excel_Office c:userstabish.khandocumentsvisual studio
2015ProjectsRead Data From Excel_OfficeRead Data From
Excel_OfficeOfficeReadExcel.cs 18 Active




Please help me resolve this issue.










share|improve this question
























  • Did you google the error message? What did you find? What did you try to fix it?

    – JeffC
    Mar 20 '17 at 16:24











  • @Mark, yes I tried googling the error. None of the solutions worked. One of the solutions asked me to add the Microsoft.CSharp.dll file. This too didn't work.

    – Tabish Khan
    Mar 20 '17 at 16:32














0












0








0


1






I'm trying to read username and password from excel sheet while using Selenium in C# .NET. Below is the code:



using excel = Microsoft.Office.Interop.Excel;

public void TestMethod1()

excel.Application xlApp = new excel.Application();
excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"D:TestTestData.xlsx");
excel._Worksheet xlWorksheet = **xlWorkbook.Sheets[1];**
excel.Range xlRange = xlWorksheet.UsedRange;



I'm getting the following error at the text that is marked in bold in above code:




Error CS0656 Missing compiler required member
'Microsoft.CSharp.RuntimeBinder.Binder.Convert' Read Data From
Excel_Office c:userstabish.khandocumentsvisual studio
2015ProjectsRead Data From Excel_OfficeRead Data From
Excel_OfficeOfficeReadExcel.cs 18 Active




Please help me resolve this issue.










share|improve this question
















I'm trying to read username and password from excel sheet while using Selenium in C# .NET. Below is the code:



using excel = Microsoft.Office.Interop.Excel;

public void TestMethod1()

excel.Application xlApp = new excel.Application();
excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"D:TestTestData.xlsx");
excel._Worksheet xlWorksheet = **xlWorkbook.Sheets[1];**
excel.Range xlRange = xlWorksheet.UsedRange;



I'm getting the following error at the text that is marked in bold in above code:




Error CS0656 Missing compiler required member
'Microsoft.CSharp.RuntimeBinder.Binder.Convert' Read Data From
Excel_Office c:userstabish.khandocumentsvisual studio
2015ProjectsRead Data From Excel_OfficeRead Data From
Excel_OfficeOfficeReadExcel.cs 18 Active




Please help me resolve this issue.







c# .net selenium automation






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 20 '17 at 11:27









Mark Fitzgerald

2,71231829




2,71231829










asked Mar 20 '17 at 11:00









Tabish KhanTabish Khan

386




386












  • Did you google the error message? What did you find? What did you try to fix it?

    – JeffC
    Mar 20 '17 at 16:24











  • @Mark, yes I tried googling the error. None of the solutions worked. One of the solutions asked me to add the Microsoft.CSharp.dll file. This too didn't work.

    – Tabish Khan
    Mar 20 '17 at 16:32


















  • Did you google the error message? What did you find? What did you try to fix it?

    – JeffC
    Mar 20 '17 at 16:24











  • @Mark, yes I tried googling the error. None of the solutions worked. One of the solutions asked me to add the Microsoft.CSharp.dll file. This too didn't work.

    – Tabish Khan
    Mar 20 '17 at 16:32

















Did you google the error message? What did you find? What did you try to fix it?

– JeffC
Mar 20 '17 at 16:24





Did you google the error message? What did you find? What did you try to fix it?

– JeffC
Mar 20 '17 at 16:24













@Mark, yes I tried googling the error. None of the solutions worked. One of the solutions asked me to add the Microsoft.CSharp.dll file. This too didn't work.

– Tabish Khan
Mar 20 '17 at 16:32






@Mark, yes I tried googling the error. None of the solutions worked. One of the solutions asked me to add the Microsoft.CSharp.dll file. This too didn't work.

– Tabish Khan
Mar 20 '17 at 16:32













2 Answers
2






active

oldest

votes


















0














I have the same error with my C# Class Library project. I'm using .NET Framework 4.6 and I used NuGet to install the Microsoft.Office.Interop.Excel assembly:



PM> Install-Package Microsoft.Office.Interop.Excel


Here is a simplified version of the code which causes this error:



using MSExcel = Microsoft.Office.Interop.Excel;

namespace ProjectReader

public class ExcelExport


public ExcelExport()

xlApp = new MSExcel.Application();
xlWorkBook = xlApp.Workbooks.Add(System.Reflection.Missing.Value);


public void CreateFile()

object missingValue = System.Reflection.Missing.Value;

foreach (MSExcel.Worksheet sht in xlWorkBook.Sheets)

if (xlWorkBook.Worksheets.Count > 1)

sht.Delete();



**xlWorkSheet = (MSExcel.Worksheet)xlWorkBook.Sheets[1];**


private MSExcel.Application xlApp;
private MSExcel.Workbook xlWorkBook;
private MSExcel.Worksheet xlWorkSheet;




Interestingly, I have no issues referencing the worksheets in the foreach loop just above the offending line.






share|improve this answer






























    -1














    Use the following steps:-



    1. Go to your project and right click.

    2. Click on Add then click on Reference..

    3. Select Microsoft.CSharp and click on OK button then clean and
      rebuild your project.





    share|improve this answer










    New contributor




    Ankur Choudhary is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.



















      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42901883%2freading-data-from-excel-in-selenium-c-sharp%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      I have the same error with my C# Class Library project. I'm using .NET Framework 4.6 and I used NuGet to install the Microsoft.Office.Interop.Excel assembly:



      PM> Install-Package Microsoft.Office.Interop.Excel


      Here is a simplified version of the code which causes this error:



      using MSExcel = Microsoft.Office.Interop.Excel;

      namespace ProjectReader

      public class ExcelExport


      public ExcelExport()

      xlApp = new MSExcel.Application();
      xlWorkBook = xlApp.Workbooks.Add(System.Reflection.Missing.Value);


      public void CreateFile()

      object missingValue = System.Reflection.Missing.Value;

      foreach (MSExcel.Worksheet sht in xlWorkBook.Sheets)

      if (xlWorkBook.Worksheets.Count > 1)

      sht.Delete();



      **xlWorkSheet = (MSExcel.Worksheet)xlWorkBook.Sheets[1];**


      private MSExcel.Application xlApp;
      private MSExcel.Workbook xlWorkBook;
      private MSExcel.Worksheet xlWorkSheet;




      Interestingly, I have no issues referencing the worksheets in the foreach loop just above the offending line.






      share|improve this answer



























        0














        I have the same error with my C# Class Library project. I'm using .NET Framework 4.6 and I used NuGet to install the Microsoft.Office.Interop.Excel assembly:



        PM> Install-Package Microsoft.Office.Interop.Excel


        Here is a simplified version of the code which causes this error:



        using MSExcel = Microsoft.Office.Interop.Excel;

        namespace ProjectReader

        public class ExcelExport


        public ExcelExport()

        xlApp = new MSExcel.Application();
        xlWorkBook = xlApp.Workbooks.Add(System.Reflection.Missing.Value);


        public void CreateFile()

        object missingValue = System.Reflection.Missing.Value;

        foreach (MSExcel.Worksheet sht in xlWorkBook.Sheets)

        if (xlWorkBook.Worksheets.Count > 1)

        sht.Delete();



        **xlWorkSheet = (MSExcel.Worksheet)xlWorkBook.Sheets[1];**


        private MSExcel.Application xlApp;
        private MSExcel.Workbook xlWorkBook;
        private MSExcel.Worksheet xlWorkSheet;




        Interestingly, I have no issues referencing the worksheets in the foreach loop just above the offending line.






        share|improve this answer

























          0












          0








          0







          I have the same error with my C# Class Library project. I'm using .NET Framework 4.6 and I used NuGet to install the Microsoft.Office.Interop.Excel assembly:



          PM> Install-Package Microsoft.Office.Interop.Excel


          Here is a simplified version of the code which causes this error:



          using MSExcel = Microsoft.Office.Interop.Excel;

          namespace ProjectReader

          public class ExcelExport


          public ExcelExport()

          xlApp = new MSExcel.Application();
          xlWorkBook = xlApp.Workbooks.Add(System.Reflection.Missing.Value);


          public void CreateFile()

          object missingValue = System.Reflection.Missing.Value;

          foreach (MSExcel.Worksheet sht in xlWorkBook.Sheets)

          if (xlWorkBook.Worksheets.Count > 1)

          sht.Delete();



          **xlWorkSheet = (MSExcel.Worksheet)xlWorkBook.Sheets[1];**


          private MSExcel.Application xlApp;
          private MSExcel.Workbook xlWorkBook;
          private MSExcel.Worksheet xlWorkSheet;




          Interestingly, I have no issues referencing the worksheets in the foreach loop just above the offending line.






          share|improve this answer













          I have the same error with my C# Class Library project. I'm using .NET Framework 4.6 and I used NuGet to install the Microsoft.Office.Interop.Excel assembly:



          PM> Install-Package Microsoft.Office.Interop.Excel


          Here is a simplified version of the code which causes this error:



          using MSExcel = Microsoft.Office.Interop.Excel;

          namespace ProjectReader

          public class ExcelExport


          public ExcelExport()

          xlApp = new MSExcel.Application();
          xlWorkBook = xlApp.Workbooks.Add(System.Reflection.Missing.Value);


          public void CreateFile()

          object missingValue = System.Reflection.Missing.Value;

          foreach (MSExcel.Worksheet sht in xlWorkBook.Sheets)

          if (xlWorkBook.Worksheets.Count > 1)

          sht.Delete();



          **xlWorkSheet = (MSExcel.Worksheet)xlWorkBook.Sheets[1];**


          private MSExcel.Application xlApp;
          private MSExcel.Workbook xlWorkBook;
          private MSExcel.Worksheet xlWorkSheet;




          Interestingly, I have no issues referencing the worksheets in the foreach loop just above the offending line.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 23 '17 at 1:01









          Philip VenzPhilip Venz

          1




          1























              -1














              Use the following steps:-



              1. Go to your project and right click.

              2. Click on Add then click on Reference..

              3. Select Microsoft.CSharp and click on OK button then clean and
                rebuild your project.





              share|improve this answer










              New contributor




              Ankur Choudhary is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.
























                -1














                Use the following steps:-



                1. Go to your project and right click.

                2. Click on Add then click on Reference..

                3. Select Microsoft.CSharp and click on OK button then clean and
                  rebuild your project.





                share|improve this answer










                New contributor




                Ankur Choudhary is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






















                  -1












                  -1








                  -1







                  Use the following steps:-



                  1. Go to your project and right click.

                  2. Click on Add then click on Reference..

                  3. Select Microsoft.CSharp and click on OK button then clean and
                    rebuild your project.





                  share|improve this answer










                  New contributor




                  Ankur Choudhary is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.










                  Use the following steps:-



                  1. Go to your project and right click.

                  2. Click on Add then click on Reference..

                  3. Select Microsoft.CSharp and click on OK button then clean and
                    rebuild your project.






                  share|improve this answer










                  New contributor




                  Ankur Choudhary is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  share|improve this answer



                  share|improve this answer








                  edited yesterday









                  Hasta Tamang

                  8961815




                  8961815






                  New contributor




                  Ankur Choudhary is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered yesterday









                  Ankur ChoudharyAnkur Choudhary

                  92




                  92




                  New contributor




                  Ankur Choudhary is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  Ankur Choudhary is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  Ankur Choudhary is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42901883%2freading-data-from-excel-in-selenium-c-sharp%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

                      2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

                      Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme