Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Icon for Administrator rankAdministrator
3 years ago

How to combine worksheets

I have a set of data in three different worksheets. Show below is a sample of data in the first 12 rows of each worksheet

 

I will like to

 

(i) combine the 3 worksheets into a single table and

(ii) add a label to each column (or header to the table). For example, the 8 columns will have headers A,B, C, D, E, F, G, H

 

Worksheet 1

119421352516129
424341483188
1533149120114140
83137596711075
16140891432030
32251328948121
93408411412174
5674451042882
255811710085133
87684712714051
95248110285102
11770103571829

 

 

Worksheet 2

5
10
2
27
12
12
12
19
10
3
21
8

 

Wrksheeet 3

 

180
131
192
125
224
200
218
184
199
224
138
174

1 Reply

  • Hi, Syndicate_Admin 

    let
        ws1 = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("RZC5EcQwDAN7UexA/PTU4nH/bRwB2roEw5HWS1j33UR2u5prhlhkKkIGQnd7rrsu3RCCWBmGaS3eS9h34pvfdaQ40juZZVwwMwPMmEQAzijLePH00sKNVFk5TE89jsTYRlRIbJakwv8VFM2mk4hRc2IUdYwKx1IC9Aelwo6dutpq9S84H0CchM7TPN4efEiol9Chx9FrTcknH6qjdVACKV79+QE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t, Column6 = _t]),
        ws2 = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlWK1YlWMjQAU0YQ0hwiZoSNskRWbwxRbwimLJRiYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
        ws3 = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMrQwUIrVAdLGhhDa0ghCG5mCaSMjEwhtAFFnZGgBkbcwgaq3RFFnaAyVNwfyYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
        combined = 
            Table.FromColumns(
                List.Combine(
                    List.Transform(
                        {ws1, ws2, ws3}, 
                        Table.ToColumns
                    )
                ), 
                {"A".."H"}
            )
    in
        combined