Can anyone point me to a tutorial on how to export a datatable to excel? I haven't had ANY luck, and it's driving me crazy.

I read in an excel spreadsheet, change a few elements in the DataTable, and want to replace the spreadsheet to the new version OR update as necessary. But, though it compiles, it throws an exception. So I think I'm doing it completely wrong.

I can find tutorials for writing individual elements to an excel as an update, but I want to do the whole thing at once in as few lines as possible.

Here's how I imported... I'd prefer to use similar syntax...

I couldn't get daCSV.Update to work, though

		private DataTable getDataFromXLS(string strFilePath, string strSheetName)
				string strConnectionString =string.Empty;
				strConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+strFilePath+@";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1""" ;
				OleDbConnection  cnCSV =new OleDbConnection (strConnectionString);
				OleDbCommand  cmdSelect = new OleDbCommand (@"SELECT * FROM [" + strSheetName + "$" + @"]", cnCSV);
				OleDbDataAdapter daCSV = new OleDbDataAdapter();
				daCSV.SelectCommand  = cmdSelect;
				DataTable dtCSV = new DataTable ();
				daCSV = null;
				return dtCSV;
			catch(Exception ex)
				return null;