【问题标题】:Power Query - Dynamically pass a file path into File.Contents functionPower Query - 将文件路径动态传递给 File.Contents 函数
【发布时间】:2020-06-12 19:19:40
【问题描述】:

我有以下代码,它从文件中提取 txt 数据并用于 Excel 查找。

 let
    Source = Csv.Document(File.Contents("J:\Accounting\Dallas\2020 Finance\BPC Trial Balances\BPC Upload text files\05.MAY\2020.MAY_USA_v2.txt"),[Delimiter="#(tab)", Columns=5, Encoding=1252, QuoteStyle=QuoteStyle.None]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column5", Currency.Type}})
in
    #"Changed Type"

我创建了一个包含 Source Files 表列的参数表,并为 5 行中的每一行创建了一个参数值,以动态提供此查询。下面是尝试

let
    Source = Csv.Document(File.Contents(vUSA),[Delimiter="#(tab)", Columns=5, Encoding=1252, QuoteStyle=QuoteStyle.None]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column5", Currency.Type}})
in
    #"Changed Type"

问题是这不起作用,但语法没问题,因为我得到了

"Formula.Firewall: Query 'USA' (step 'Changed Type') 引用其他 查询或步骤,因此它可能无法直接访问数据源。请 重建这个数据组合。”

【问题讨论】:

    标签: firewall file-get-contents powerquery


    【解决方案1】:

    我发现这是我的 Power Query Settings 。我使用以下内容来协调问题 https://community.powerbi.com/t5/Desktop/Formula-Firewall-Query-references-other-queries-so-it-may-not/td-p/18619

    【讨论】:

      猜你喜欢
      • 2011-02-26
      • 2018-12-26
      • 1970-01-01
      • 2020-07-19
      • 1970-01-01
      • 1970-01-01
      • 2022-08-08
      • 2021-12-02
      • 2021-08-25
      相关资源
      最近更新 更多