Convert Datagrid to Excel

  • 12 years ago


    is there anyone know how to convert datagrid or datasets into excel?

  • 12 years ago

    You can use ADO.NET to read from and write to Excel just like a database, or you can use automation to control an actual Excel instance and operate directly on the worksheets.  Do a search on MSDN for "ADO.NET Excel" and "Automation Excel .NET" (both without quotes) for information and examples.  If you already have data in a DataSet, I'd say ADO.NET would be your best bet (that's using an OleDbDataAdapter).  I've never written data to Excel but I have read from it.  I can't see that it would be much more complex, if at all.

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“C++ : Where friends have access to your private members.” - Gavin Russell Baker