I have created a Microsoft Excel workbook project in Excel. What I want to do is to take in data from a text file and open that up in my worksheet. To do this I tired usign the following inside of the Sheet1.cs file:
public partial class Sheet1
{
private void Sheet1_Startup(object sender, System.EventArgs e)
{
this.Application.Workbooks.OpenText(@"C:\GG_Provider.txt",
missing, 1,
Excel.XlTextParsingType.xlDelimited,
Excel.XlTextQualifier.xlTextQualifierNone,
missing, missing, missing, missing, missing, true, "|",
missing, missing, missing, missing, missing, missing);
}
This opens up the data successfully however it does so in a brand new workbook. So when I run my application it opens up two different workbooks. One blank one and one with all of the data in it and a worksheet with the same name as the text file.
What can I do so that the data goes into the original workbook that is currently blank?