Does anyone have an example on how to export a DataGridView to an excel spreadsheet?
The DataGridView is bound to a dataset.
Thanks.
Does anyone have an example on how to export a DataGridView to an excel spreadsheet?
The DataGridView is bound to a dataset.
Thanks.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Mike GoldRank #50 · 30.6K reputationPosted Oct 12, 2007, 1:57 PM EDT
There are two ways.
You can try binding directly to Excel through OleDb:
http://www.spreadsheetgear.com/support/samples/datagrid.aspx
http://support.microsoft.com/kb/306572
or you can use InterOp to populate Excel:
http://www.c-sharpcorner.com/UploadFile/mgold/Query2Excel12032005011029AM/Query2Excel.aspx
Best,