Click here to Skip to main content
Licence 
First Posted 27 Nov 2003
Views 185,444
Bookmarked 62 times

Export excel data to a Dataset

By | 27 Nov 2003 | Article
A usercontrol that exports from excel to a dataset without needing MS office to be installed.

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

Web Developer

United Kingdom United Kingdom

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralExport to excel through user control Pinmemberpreetej19:38 30 Jul '08  
GeneralExport to Dataset PinmemberBarbaMariolino3:45 14 May '08  
Questionis it possible to use it withot the gui ? PinmemberMember 15181672:52 9 May '08  
AnswerRe: is it possible to use it withot the gui ? PinmemberCikaPero21:22 4 Sep '11  
Questionhow to view /access the exported dataset Pinmemberk.philip21:09 4 Oct '07  
AnswerRe: how to view /access the exported dataset Pinmemberk.philip21:15 4 Oct '07  
Questionhow to set datatype of imported Excel sheet Pinmemberjaganil2:01 1 Aug '07  
NewsUpdate to read csv and tab delimited files Pinmemberthe bill23:42 11 May '07  
GeneralRe: Update to read csv and tab delimited files PinmemberPeter Nevill19:58 18 Jul '07  
QuestionCode sometimes Wont get the OLEDB Schema PinmemberSimple but Effective0:55 15 Aug '06  
Questionhow to import Excel file data in c# PinmemberJayGosavi21:41 7 Aug '06  
AnswerRe: how to import Excel file data in c# Pinmemberalex.almeida10:21 4 Apr '07  
AnswerHi to all Pinmemberanuragji2001022:06 18 Jul '11  
GeneralAlternative way PinmemberJan Gex5:46 19 Dec '05  
GeneralNice Very Very Usefull Pinmembervivekthangaswamy23:29 7 Jul '05  
QuestionHow can I use dataset to Excel? PinmemberPeter Sze16:13 29 Dec '04  
AnswerRe: How can I use dataset to Excel? PinsussAnonymous22:54 15 Jun '05  
Generaldo you have code in VB.net Pinmemberkoonlee1:56 27 Aug '04  
GeneralOnly 255 chars PinmemberAl. Ceausu18:26 5 Aug '04  
GeneralRe: Only 255 chars Pinmemberjasperp20:06 30 May '07  
I found it to be a limitation of 8217 characters for one column, not 255. I think it is something to do with OLEDB because if I import the same spreadsheet into MS Access using the MS Acces file import feature, MS Access also truncates it to 8217 characters.
 
www.timelineforum.com
Generalnumeric field values are not retrieved PinmemberDaberElay0:06 30 Jul '04  
GeneralRe: numeric field values are not retrieved PinmemberDaberElay5:56 31 Jul '04  
GeneralRe: numeric field values are not retrieved PinmemberVinay K. Ladwal3:57 21 Aug '06  
GeneralRe: numeric field values are not retrieved PinmemberDaberElay9:26 21 Aug '06  
QuestionRe: numeric field values are not retrieved PinmemberVinay K. Ladwal0:29 22 Aug '06  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120529.1 | Last Updated 28 Nov 2003
Article Copyright 2003 by ksgopal
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid