Click here to Skip to main content
6,292,426 members and growing! (9,981 online)
Email Password   helpLost your password?
Platforms, Frameworks & Libraries » .NET Framework » General     Intermediate

Export excel data to a Dataset

By ksgopal

A usercontrol that exports from excel to a dataset without needing MS office to be installed.
C#, Windows, .NET 1.1VS.NET2003, Dev
Posted:27 Nov 2003
Views:144,154
Bookmarked:53 times
Announcements
Loading...
 
Search    
Advanced Search
printPrint   Broken Article?Report       add Share
  Discuss Discuss   Recommend Article Email
23 votes for this article.
Popularity: 5.33 Rating: 3.91 out of 5
4 votes, 17.4%
1
2 votes, 8.7%
2
1 vote, 4.3%
3
5 votes, 21.7%
4
11 votes, 47.8%
5

Introduction

If you ever need to add functionality to your application to enable you to export an excel file as a Dataset, instead of coding it by yourself, use this control. Using this you can let the user select the column names of the datatable in the exported Dataset. You can also restrict the user to select column names from a list of specified column names.

Background

This control uses System.Data.OleDbClient namespace to connect to the excel file as a data store. It doesn't need MS Excel to be installed on the computer.

Using the code

  1. Copy Gopal.Data.Transform.dll to your application folder. Right click on the toolbox and select 'Add/Remove components' as shown below.

  2. Now select 'ExcelExportControl' from 'Gopal.Data.Transform' assembly and press 'OK' as shown below.

  3. The 'ExcelExportControl' has now been added to the toolbox and can be used.

  4. This control will now allow you to load an excel file. You can select the first row as the column names by checking the checkbox which says so.
  5. The first tabpage lets you preview all the sheets in the excel file.

  6. The second tabpage lets you select an output dataset name, datatable name and column names too.

The download package has the source code, assembly and a demo form using the assembly.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

ksgopal


Member

Occupation: Web Developer
Location: United Kingdom United Kingdom

Other popular .NET Framework articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 35 (Total in Forum: 35) (Refresh)FirstPrevNext
GeneralExport to excel through user control Pinmemberpreetej20:38 30 Jul '08  
GeneralExport to Dataset PinmemberBarbaMariolino4:45 14 May '08  
Generalis it possible to use it withot the gui ? PinmemberMember 15181673:52 9 May '08  
Questionhow to view /access the exported dataset Pinmemberk.philip22:09 4 Oct '07  
AnswerRe: how to view /access the exported dataset Pinmemberk.philip22:15 4 Oct '07  
Generalhow to set datatype of imported Excel sheet Pinmemberjaganil3:01 1 Aug '07  
NewsUpdate to read csv and tab delimited files Pinmemberthe bill0:42 12 May '07  
GeneralRe: Update to read csv and tab delimited files PinmemberPeter Nevill20:58 18 Jul '07  
QuestionCode sometimes Wont get the OLEDB Schema PinmemberSimple but Effective1:55 15 Aug '06  
Questionhow to import Excel file data in c# PinmemberJayGosavi22:41 7 Aug '06  
AnswerRe: how to import Excel file data in c# Pinmemberalex.almeida11:21 4 Apr '07  
GeneralAlternative way PinmemberJan Gex6:46 19 Dec '05  
GeneralNice Very Very Usefull Pinmembervivekthangaswamy0:29 8 Jul '05  
GeneralHow can I use dataset to Excel? PinmemberPeter Sze17:13 29 Dec '04  
GeneralRe: How can I use dataset to Excel? PinsussAnonymous23:54 15 Jun '05  
Generaldo you have code in VB.net Pinmemberkoonlee2:56 27 Aug '04  
GeneralOnly 255 chars PinmemberAl. Ceausu19:26 5 Aug '04  
GeneralRe: Only 255 chars Pinmemberjasperp21:06 30 May '07  
Generalnumeric field values are not retrieved PinmemberDaberElay1:06 30 Jul '04  
GeneralRe: numeric field values are not retrieved PinmemberDaberElay6:56 31 Jul '04  
GeneralRe: numeric field values are not retrieved PinmemberVinay K. Ladwal4:57 21 Aug '06  
GeneralRe: numeric field values are not retrieved PinmemberDaberElay10:26 21 Aug '06  
QuestionRe: numeric field values are not retrieved PinmemberVinay K. Ladwal1:29 22 Aug '06  
AnswerRe: numeric field values are not retrieved PinmemberDaberElay13:35 23 Aug '06  
GeneralRe: numeric field values are not retrieved Pinmemberugurcan778:09 24 Aug '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 27 Nov 2003
Editor: Nishant Sivakumar
Copyright 2003 by ksgopal
Everything else Copyright © CodeProject, 1999-2009
Web13 | Advertise on the Code Project