Convert categories into columns



The Excel file book1.xlsx has two columns of Car and Color. Part of the data is shown in the figure below:

Now you need to convert the data into the following format: name the Car type as a column, list all the colors of this car and remove the duplicate colors.

Write SPL script:













A1 Read in the book1.xlsx file data, the option @t means that the first row is the column name

A2 Group by Car, in each group the Car and its different colors form a sequence, means to take the color that is not repeated in this group

A3 Calculate the maximum length of each group sequence

A4 Fill each group sequence with null to the maximum length for transposing

A5 Transpose the ranks of A4

A6 Save A5 to the file book2.xlsx, the option @w means that the written A5 is a sequence composed of sequences