title: "The given ColumnMapping does not match up with any column in the source or destination" while importing Excel into SQL Server using C#
body: <p>I am getting an error </p>
  
  <blockquote>
    <p>The given ColumnMapping does not match up with any column in the source or destination</p>
  </blockquote>
  
  <p>with the following code</p>
  
  <pre><code>private void button1_Click_1(object sender, EventArgs e)
  {
      of1.Filter = "Excel Files|*.xls;*.xlsx;*.xlsm";
  
      if ((of1.ShowDialog()) == System.Windows.Forms.DialogResult.OK)
      {
          imagepath = of1.FileName; //file path
          textBox1.Text = imagepath.ToString();
      }
  }
  
  private void loadbtn_Click(object sender, EventArgs e)
  {
      string ssqltable = comboBox1.GetItemText(comboBox1.SelectedItem);
      string myexceldataquery = "select * from ["+ ssqltable + "$]";
  
      try
      {
          OleDbConnection oconn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source="+imagepath+";Extended Properties='Excel 12.0 Xml; HDR=YES;IMEX=1;';");
          string ssqlconnectionstring = "Data Source=.;Initial Catalog=Bioxcell;Integrated Security=true";
  
          OleDbCommand oledbcmd = new OleDbCommand(myexceldataquery, oconn);
          oconn.Open();
  
          OleDbDataReader dr = oledbcmd.ExecuteReader();
  
          SqlBulkCopy bulkcopy = new SqlBulkCopy(ssqlconnectionstring);
          bulkcopy.DestinationTableName = ssqltable;
  
          while (dr.Read())
          {
              bulkcopy.WriteToServer(dr);
          }
  
          oconn.Close();
      }
      catch (Exception ex)
      {
          MessageBox.Show(ex.ToString());
      }
  
      /* DisplayingData DD = new DisplayingData();
      DD.Show();*/
  }
  </code></pre>
  
  <p>I think SQL Server is case sensitive and I copied the same column names but the same error .. </p>
  
  <p><img src="https://i.stack.imgur.com/7mypZ.jpg" alt="Excel File"></p>
  
  <p><img src="https://i.stack.imgur.com/Ry977.jpg" alt="Database"></p>
  
  <p>Is there any way around this?</p>