Tag Archives: excel

excel export table name with space but in excel get the sheet name with “_” C#

Questions: I using C# to write code that exporting table to excel in “.xls” format, and try to give the sheet name name with space. I try something like this: string header = “CREATE TABLE [Table Name]” string constring = @”Provider=Microsoft.ACE.OLEDB.12.0;Data Source=” + @FilePath + “;Extended Properties=\”Excel 12.0;HDR=YES;\””; myConnection = new OleDbConnection(constring); myConnection.Open(); var cmd… Read More »

Make an array from all Excel worksheets

Questions: I have a C# code that connects to Excel database via OpenFileDialog func. Excel file has too many worksheets and I would like to get all their names in one array and add them to combobox. For example, this one is the first Excel document. Any suggestions? Answers: