title: C# Paste Clipboard content into Excel worksheet
body: <p>As the title says, I try to actually paste what is in my Clipboard into an Excel.</p>
  
  <p>I've following code:</p>
  
  <pre><code>Clipboard.SetText(html);
  sheet.Range("A1").Value = Clipboard.GetText(); 
  </code></pre>
  
  <p>Actually, the variable html contains a html code file, when I do it like that, I actually paste only the html content into the Range, but, if I open Excel and do by hand, Paste Special... I can paste the html code, but it transforms the code into a real table instead of a html code and this is the real result that I want, without doing it by hand.</p>
  
  <p><a href="https://stackoverflow.com/questions/14529483/excel-range-copy-paste-with-clipboard-gettext">Excel.Range.Copy() paste with Clipboard.GetText()</a></p>
  
  <p>Another way was:</p>
  
  <pre><code>foreach (Excel.Worksheet sheet in workbook.Sheets)
  {
      foreach (Excel.Shape shape in sheet.Shapes)
      {
          Clipboard.SetText(html);
  
          //doesn't work:                              
          sheet.Range("A1").Value = sheet.PasteSpecial(Clipboard.GetText()); 
  
          sheet.PasteSpecial(Clipboard.GetText()); //throws error
      }
  }
  </code></pre>
  
  <p>But this way doesn't work too. I can do it with an html -> image and paste the image, but real values should be accessible and not a picture.</p>
  
  <p>Hope someone can clarify how to solve it.</p>
  
  <p>Thanks.</p>