是否可以连接到 Excel .xlsx 文件中的 PowerPivot 数据模型?(不是托管在 SharePoint 站点上...只是本地文件)。
一定可以,因为 Tableau 可以做到。
有人有什么线索吗?
是否可以连接到 Excel .xlsx 文件中的 PowerPivot 数据模型?(不是托管在 SharePoint 站点上...只是本地文件)。
一定可以,因为 Tableau 可以做到。
有人有什么线索吗?
简短回答:
详细回答:
参考/致谢:
详情:
像@gobansaor一样,我们发现使用已经与PP缓存连接的工作簿很有帮助(必要?)。例如,在通过AMO连接到PP缓存之前,我们确保连接是活动的:
ThisWorkbook.Connections["PowerPivot Data"].Reconnect()
或者
ThisWorkbook.Connections["PowerPivot Data"].Refresh()
我们用于AMO的连接字符串模板是:Provider=MSOLAP;Data Source=$Embedded$;Locale Identifier=1033;Location={0};SQLQueryMode=DataKeys
,我们用ThisWorkbook.FullName
填充了该模板。
按照@gobansaor的方法,我们使用以下代码连接到了数据立方体:
ADODB.Recordset recordSet = new ADODB.Recordset();
recordSet.Open("SELECT [Measures].[Min of Field1] ON COLUMNS FROM [Model]",
ThisWorkbook.Connections["PowerPivot Data"].OLEDBConnection.ADOConnection);