Forum Discussion
Imported data from multiple SharePoint lists not coming through under the same column
- 4 years ago
I agree with what Ehren has said. The thing to watch out for with SharePoint lists, what the columns are visually named as are not neccessarily what they are called in the background.
If you know the number of columns, you could define the new column names and rename all of the columns dynamically.
Example, paste these into two separate queries to see what I mean. Alternately, attached PBIX file for your convenience.
// Columns let Source = Table.FromRows( Json.Document( Binary.Decompress( Binary.FromText("i45Wcs4vzSspqlSK1YlWCijKTylNLgGzgxNzUouVYmMB", BinaryEncoding.Base64), Compression.Deflate ) ), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [NewColumns = _t] ), #"Changed Type" = Table.TransformColumnTypes(Source, {{"NewColumns", type text}}) in #"Changed Type"// Table let Source = Table.FromRows( Json.Document( Binary.Decompress( Binary.FromText( "i45Wck7MS0xJVNIBMoqKUktSi0BsYyNjcwOlWJ1oJbeixLzkVAxpM6g0XLdvfl4JkA2SNDAyNMMpaWxsaGGuZwqW902tyEzOR5E3sjA3MQAaHQsA", BinaryEncoding.Base64 ), Compression.Deflate ) ), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [C = _t, P = _t, S = _t] ), #"Changed Type" = Table.TransformColumnTypes( Source, {{"C", type text}, {"P", type text}, {"S", type number}} ), OldColumns = List.Buffer(Table.ColumnNames(#"Changed Type")), NewColumns = List.Buffer(Table.ToList(Columns)), RenameList = List.Buffer(List.Zip({OldColumns, NewColumns})), Rename = Table.RenameColumns(#"Changed Type", RenameList, MissingField.Ignore) in Rename
I agree with what Ehren has said. The thing to watch out for with SharePoint lists, what the columns are visually named as are not neccessarily what they are called in the background.
If you know the number of columns, you could define the new column names and rename all of the columns dynamically.
Example, paste these into two separate queries to see what I mean. Alternately, attached PBIX file for your convenience.
// Columns
let
Source = Table.FromRows(
Json.Document(
Binary.Decompress(
Binary.FromText("i45Wcs4vzSspqlSK1YlWCijKTylNLgGzgxNzUouVYmMB", BinaryEncoding.Base64),
Compression.Deflate
)
),
let
_t = ((type nullable text) meta [Serialized.Text = true])
in
type table [NewColumns = _t]
),
#"Changed Type" = Table.TransformColumnTypes(Source, {{"NewColumns", type text}})
in
#"Changed Type"
// Table
let
Source = Table.FromRows(
Json.Document(
Binary.Decompress(
Binary.FromText(
"i45Wck7MS0xJVNIBMoqKUktSi0BsYyNjcwOlWJ1oJbeixLzkVAxpM6g0XLdvfl4JkA2SNDAyNMMpaWxsaGGuZwqW902tyEzOR5E3sjA3MQAaHQsA",
BinaryEncoding.Base64
),
Compression.Deflate
)
),
let
_t = ((type nullable text) meta [Serialized.Text = true])
in
type table [C = _t, P = _t, S = _t]
),
#"Changed Type" = Table.TransformColumnTypes(
Source,
{{"C", type text}, {"P", type text}, {"S", type number}}
),
OldColumns = List.Buffer(Table.ColumnNames(#"Changed Type")),
NewColumns = List.Buffer(Table.ToList(Columns)),
RenameList = List.Buffer(List.Zip({OldColumns, NewColumns})),
Rename = Table.RenameColumns(#"Changed Type", RenameList, MissingField.Ignore)
in
Rename