Home > Enterprise >  Expression.Error: 2 arguments were passed to a function which expects 1
Expression.Error: 2 arguments were passed to a function which expects 1

Time:01-27

I have been trying to build an automated vba tool to pull API data but kept having below error from 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..

CodePudding user response:

Fairly sure it is this line. Try changing it to the following:

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