Using Excel as a database

3 ビュー (過去 30 日間)
Michel
Michel 2015 年 8 月 11 日
コメント済み: Michel 2016 年 3 月 9 日
I am trying to connect to Excel from MatLab using an Excel workbook tab as a Database (I don't want to just import/export data from Excel into MatLab).
How do I set up the "connection" parameters for that?.
Below is what it looks like if I connect to Excel from Excel itself using an Excel workbook tab as a Database.
----------------------------------------------------------------
Sub Test_Insert_Value()
Dim Temp_Data As New ADODB.Recordset
Dim S_Statement As String
Dim Conn As New ADODB.Connection
Dim DBPath As String
Dim sconnect As String
DBPath = ThisWorkbook.FullName
sconnect = "Provider=MSDASQL.1;DSN=Excel Files;DBQ=" & DBPath & ";HDR=Yes';"
Conn.Open sconnect
S_Statement = " (SELECT * FROM [Temp_Table]"
Temp_Data.Open S_Statement, Conn
Conn.Close
End Sub
-----------------------------------------------------------------------------
This may be related to the solution:

採用された回答

Varun Bhaskar
Varun Bhaskar 2015 年 8 月 13 日
Hello,
The script attached illustrates how to fetch data into MATLAB from an Excel database. It has explanatory comments.
  1 件のコメント
Michel
Michel 2016 年 3 月 9 日
Thanks Varun.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by