简体   繁体   English

Expression.Error: 2 arguments 传递给 function 期望 1

[英]Expression.Error: 2 arguments were passed to a function which expects 1

I have been trying to build an automated vba tool to pull API data but kept having below error from Power Query...我一直在尝试构建一个自动化的 vba 工具来提取 API 数据,但 Power Query 一直出现以下错误...

Expression.Error: 2 arguments were passed to a function which expects 1. Details: Pattern= Arguments=[List]

Kept looking up the solution but could not really find the right reason...一直在寻找解决方案,但找不到正确的原因......

Here is my code as below这是我的代码如下

let

    Parameter = Excel.CurrentWorkbook(){[Name="Parameter"]}[Content],

    URL= Parameter[Column1]{0},

    Source = Json.Document(Web.Page(Web.Contents(URL), [
        Headers =[#"Authorization"="Basic ENCODE64PASSWORDS"]])),
    
    #"Converted to Table" = Record.ToTable(Source),
    Value = #"Converted to Table"{0}[Value],
    results = Value[results],


    #"Converted to Table1" = Table.FromList(results, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table1", "Column1", {"path", "upsertable"}, {"path", "upsertable"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded Column1", each ([upsertable] = true)),
    #"Sorted Rows" = Table.Sort(#"Filtered Rows",{{"path", Order.Ascending}})
in
    #"Sorted Rows"

I am no professional coder but just started to feel interested in coding world.我不是专业的编码员,但刚开始对编码世界感兴趣。 This code is mostly just mixture of copy and paste all over the web haha So please understand im only a beginner with a baby step and forgive my ignorance if this is actually a simple matter..or if I dont really understand your reply well..这段代码主要是复制和粘贴整个 web 哈哈 所以请理解我只是一个刚刚迈出第一步的初学者,如果这实际上是一件简单的事情..或者如果我不太理解你的回复,请原谅我的无知..

Fairly sure it is this line.相当肯定是这条线。 Try changing it to the following:尝试将其更改为以下内容:

Source = Json.Document(Web.Page(Web.Contents(URL, [
        Headers =[#"Authorization"="Basic ENCODE64PASSWORDS"]]))),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM