【问题标题】:Invalid absolute path error when parameterising Excel path on SharePoint site in Power Query在 Power Query 中参数化 SharePoint 网站上的 Excel 路径时出现无效的绝对路径错误
【发布时间】:2016-07-24 03:21:29
【问题描述】:

我有一个指向 SharePoint 网站上 Excel 文件的有效、有效的绝对路径(例如“https://.../Filename.xlsx”),用 “FilePath” 表示。

我尝试通过 Power Query 从 "FilePath" 导入一些信息。使用

let
    Source = Excel.Workbook(Web.Contents("FilePath"), null, true),

工作正常。但是,如果我尝试将 "FilePath" 参数化,方法是将其放置在名为 Source_Files 的 Excel 表的第一行中,该表位于我的 Power Query 所在的同一个 Excel 文件(我导入到 PowerQuery),我总是得到

DataFormat.Error: The supplied file path must be a valid absolute path.
Details:
    FilePath 

错误,我是否尝试这样参数化:

let
    Source = Excel.Workbook(File.Contents(Source_Files[Source file]{0}), null, true),

或者这样:

let    
    FilePath = File.Contents(Source_Files[Source file]{0}),
    Source = Excel.Workbook(Web.Contents(FilePath), null, true),

如何在 Power Query 中参数化 SharePoint 网站上的 Excel 文件?

【问题讨论】:

  • 某处有特殊字符吗?另外,您是否尝试过 Power Query 的 SharePoint 连接器?

标签: excel sharepoint powerquery dataformat


【解决方案1】:

我认为替换“FilePath”的语法是:

Text.From(Excel.CurrentWorkbook(){[Name="Source_Files"]}[Content]{0}[Source file])

【讨论】:

  • 谢谢@MikeHoney,它有效!现在我想知道为什么......是因为File.Contents 返回一个二进制文件? File.Contents 非常适用于具有本地或网络文件 UNC 路径的表,但不适用于 SharePoint 链接(我猜是 Web 地址中的文件)。即使包装了Text.FromFile.Contents 在我的情况下也不起作用。
  • 对于共享点,使用共享点或 onedrive 连接器是最简单的方法。否则,您可以将 Web.Contents 与 sharepoint API 一起使用。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-05-20
  • 2017-11-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-09-17
相关资源
最近更新 更多