2

Is it possible to make some kind of link from SQL to Excel making the Excel documents the true datasource? I don't want any data to be stored in SQL, all data editing will be done in the Excel sheets.

I know this is far from optimal but I don't have a choice, the data needs to stay in Excel.

I know there is an option to do this kind of links in Access and there I can access the data from within VS but I would really prefer SQL.

3
  • Why do you need to use Excel? Commented Jun 27, 2012 at 23:24
  • Use this link to find some info on excel and sql linkage support.microsoft.com/kb/306397 Commented Jun 27, 2012 at 23:34
  • Are you saying SQL (Structured Query Language), but you really mean SQL Server (the Microsoft RDBMS product) by that? Commented Jun 28, 2012 at 5:25

3 Answers 3

3

It's also possible to use the Jet driver directly from your application and skip out SQL server.

I know this isn't a proper answer to your question but another thought that may be useful :)

Sign up to request clarification or add additional context in comments.

Comments

1

Yes, you can set up excel as a linked server. You'll need to use a jet driver but this is only available on 32bit machines (Microsoft dropped their support a while back). In other words, this is completely not scale-able and not recommended in most production environments.

Comments

0

If you want to choose Excel as a datasource then you can connect to it using .Net Oledb provider.

Consider VB.Net example below to read rows on excel sheet:

  imports System.Data.OleDb

        dim connstr as string = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\exceldb.xls;Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"""
            Dim conn As New OleDbConnection(connstr)
            conn.Open()
            Dim da As New OleDbDataAdapter("select * from [Sheet1$]", conn)
    Dim dt As New DataTable()
    da.fill(dt)
    For i As Integer = 0 To dt.Rows.Count - 1
     'do your thing
    next
    conn.close()

Regards

1 Comment

How would you do this with multiple Excel files? Could you do a join of workbooks from different files, for instance?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.