excel sheet

I am using vb.net desktop version, need to convert a excel sheet to csv.
Need to calculate the used range of excel and convert it into comma seperated csv.

***Please note speed is an issue here, if you suggest any code with high performance it will be appreciated the most.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shaun VermaakTechnical SpecialistCommented:
If speed is an issue, you only have one option IMO

I have done various document automation processes and GemBox Spreadsheet is the fastest library I have found.
GemBox  is good library,
But in some cases GemBox  can be not free. Also you can use NPOI. It is free low-level api to work with excel.
RIASAuthor Commented:
Thanks,Any vb.net code please , appreciate it
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

RIASAuthor Commented:
Cannot use any third party
You can read EXcel with Ado net, put data to string with symbol ";" and wtite this data to file. Try this code:
Imports System.Data.Odbc
Imports System.IO
Module Module1
    Sub Main()
            Dim ConnectionString As String = "Driver={Microsoft Excel Driver (*.xls)};DBQ=D:\Test.xls"
            Dim file As StreamWriter
            file = My.Computer.FileSystem.OpenTextFileWriter("D:\Test.csv", True)
            Dim conn As New OdbcConnection(ConnectionString)
            Dim sql As String = "Select * FROM [Sheet1$]"
            Dim da As New OdbcDataAdapter(sql, conn)
            Dim ds As New DataSet()
            da.Fill(ds, "Sheet1")
            Dim Result As String = ""
            For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
                For j As Integer = 0 To ds.Tables(0).Columns.Count - 1
                    Result += ds.Tables(0).Rows(i).Item(j) + ";"
                file.WriteLine(Result.Substring(0, Result.Length - 1))
                Result = ""

Open in new window

In vain you refuse good libraries. Many actions are already made for you in this lybraries.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RIASAuthor Commented:
Glad to help you!
Shaun VermaakTechnical SpecialistCommented:
In vain you refuse good libraries. Many actions are already made for you in this lybraries.
Not only do libraries make it easier, GemBox does not use Office so you do not need licenses and it is 20 times faster than Office automation
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.