Deduplicating without changing original orders

chuxin huo
Jul 21, 2021

Example

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

Delete the repeated colors in each car without changing the original data sequence, as shown in the following figure:

Write SPL script:

A1 Read in book1.xlsx file data

A2 Group by Car and Color, the option @p means to return the sequence of numbers formed by the position of the group members in A1, 1 means that only the first record of each group will be taken after grouping

A3 After sorting the sequence in A2, take out the records of the corresponding serial number from A1 in this order

A4 Save A3 to the file book2.xlsx

--

--