Help needed regarding Excel Interop
Hi all,
I'm working on an Excel Interop application using C#.
I'm facing 2 problems described below:
1.Am using OleDbCommand and INSERT INTO query
to insert data from a .Net datatable into an excel sheet.
Am getting the following error during the same:
"The field is too small to accept the amount of data you attempted to add.
Try inserting or pasting less data."
Any idea,how to fix this???
2.I'm trying to delete a worksheet from an existing excel file using the following C# code.But, the worksheet is not getting deleted...
Am doing something wrong...??Is there any other approach...??
foreach(Excel.Worksheet ws in wkBook.Sheets)
{
if (ws.Name.ToString().Trim().ToUpper() == viewName.ToUpper())
{
ws.Delete();
break;
}
}
//Save changes to Excel file
wkBook.Save();
wkBook.Close(true, excelFilePath, Type.Missing);
Thanks in advance...!
Cheers,
|