1

How would I import the following json

{
    "Column1": ["r1c1", "r2c1", "r3c1"],
    "Column2": ["r1c2", "r2c2", "r3c2"],
    "Column3": ["r1c3", "r2c3", "r3c3"]
}

using PowerQuery and get the table in Excel:

enter image description here

?

Notes:

I already tried without success Data\Connect to data...

enter image description here

... Into Table...

enter image description here

enter image description here

enter image description here

Thanks

4
  • data .. get data .. from file ... from JSON ... then after review file ... close and load Commented Oct 17, 2022 at 11:13
  • Thanks for the quick reply, I already tried that :-) and a few other mashups without success Commented Oct 17, 2022 at 11:20
  • from your image, click the arrow atop the Value column to expand it Commented Oct 17, 2022 at 11:33
  • @horseyride: the json is NOT the "normal" row style json (aka [{"column1": "r1c1", "column2": "r1c2"}, {"column1": "r2c1", "column2": "r2c2"}...]). It's a "columnar style" json - each key represents a column P.S.: thanks Commented Oct 17, 2022 at 11:39

1 Answer 1

1

Try

let Source = Record.ToTable(Json.Document(File.Contents("C:\Temp\test.json"))),
#"Added Custom" = Table.AddColumn(Source, "Custom", each Table.AddIndexColumn(Table.FromList([Value], null, {"contents"}), "Index", 0, 1, Int64.Type)),
#"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"contents", "Index"}, {"contents", "Index"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Value"}),
#"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Name]), "Name", "contents"),
#"Removed Columns1" = Table.RemoveColumns(#"Pivoted Column",{"Index"})
in  #"Removed Columns1"

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.