Hi,
How to copy from csv file worksheet into currently active excel worksheet.
How can I do that?
thanks
Copy from csv file to excel worksheet
Re: Copy from csv file to excel worksheet
HI,
You can try the below solution
This code will take a .csv file as the input and generate a new .xlsx file copying the contents of the csv to it.
You can try the below solution
Code: Select all
string inputFilepath = @"C:\Temp\output.csv";
string outputFilepath= @"C:\temp\testtable.xlsx";
Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.ApplicationClass();
Microsoft.Office.Interop.Excel.Workbook wb = app.Workbooks.Open(inputFilepath);
wb.SaveAs(outputFilepath, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookDefault);
wb.Close(false);
app.Quit();
This code will take a .csv file as the input and generate a new .xlsx file copying the contents of the csv to it.
Re: Copy from csv file to excel worksheet
Hi,
I am sorry,My explanation is missing. I don't want to create a new Excel file.
I want to copy from csv file data into already exit excel file.
thanks.
I am sorry,My explanation is missing. I don't want to create a new Excel file.
I want to copy from csv file data into already exit excel file.
thanks.