title: query to read a column excel worksheet with OLEDB
body: <p>I'm totally new with OleDB and reading excel files. I have a worksheet with 3 columns (Name - Surname - E-mail Address) and I need to:</p>
  
  <ul>
  <li>know the rows number</li>
  <li>read all the addresses in the third columns</li>
  <li>extract one by one each address</li>
  </ul>
  
  <p>I use an OpenFileDialog object (ofd) and a TextBox (excel) to display the selected file. This is my code:</p>
  
  <pre><code>if (ofd.ShowDialog() == DialogResult.OK)
  {
      excel.Text = ofd.FileName;
      connection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excel.Text + ";Extended Properties=\"Excel 12.0 Xml;HDR=NO;IMEX=1\"";
      conn.ConnectionString = connection;
      conn.Open();
      string name_query = "SELECT A FROM[" + ofd.SafeFileName + "]";
      OleDbDataAdapter da = new OleDbDataAdapter(name_query, conn);
      da.Fill(table);
      conn.Close();
      j = table.Rows.Count;
  }
  </code></pre>
  
  <p>It doesn't work, a query problem in the "FROM...". I usually read this type of query:</p>
  
  <pre><code>"SELECT * FROM [Sheet1$]"
  </code></pre>
  
  <p>but I can't find what <code>Sheet1$</code> exactly is. Someone could explain me the right query?</p>
  
  <p>2) To access to each element of the table (it would contain only the third column) and save it in a string variable what I have to do?</p>
  
  <p>Thanks a lot!</p>