Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 9th, 2006, 09:45 AM
Authorized User
Join Date: Mar 2006
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default excel

i have a few excel sheets , how can i view them in my app.

or import them in a database

Reply With Quote
  #2 (permalink)  
Old July 18th, 2013, 08:05 AM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Nov 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: excel

Hi, to me the easiest way would be to export Excel to DataGridView like this:
' Load Excel (XLSX) from a file.
Dim workbook = ExcelFile.Load("Workbook.xlsx")

' Export active worksheet to DataGridView.
    New ExportToDataGridViewOptions() With {.ColumnHeaders = True})
Also here is how to import Excel sheets to a DataSet, every sheet is a new DataTable:
Dim dataSet = New DataSet()

' Load Excel file.
Dim workbook = ExcelFile.Load("Workbook.xls")

' Export all worksheets to DataSet.
For Each worksheet In workbook.Worksheets
    ' Extract the data from the worksheet to newly created DataTable starting at 
    ' first row and first column for 10 rows or until the first empty row appears.
    Dim dataTable = worksheet.CreateDataTable(New CreateDataTableOptions() With
            .StartRow = 0,
            .StartColumn = 0,
            .NumberOfRows = 10,
            .ExtractDataOptions = ExtractDataOptions.StopAtFirstEmptyRow
    dataTable.TableName = worksheet.Name

    ' Add DataTable to DataSet.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in opening excel file in MS Excel 2000 kallol Visual C++ 0 November 16th, 2007 05:48 AM
ASP to Excel - excel output formatting issue mat41 Classic ASP Professional 0 August 13th, 2006 06:41 AM
write multi-sheet Excel w/o Excel.Application manmoth Classic ASP Components 2 November 22nd, 2005 10:56 AM
Excel in win 2000 to excel winxp (excel 2002) Max Excel VBA 3 August 28th, 2003 04:44 AM

All times are GMT -4. The time now is 11:15 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.