An uncertain number of sets to find intersection, union, and difference

chuxin huo
Jul 9, 2021

--

Example

There are multiple Excel files Book1.xlsx, Book2.xlsx, Book3.xlsx,…, the naming rule of these files is Book[N].xlsx, N is a number starting from 1, the data in the file is as follows:

Book1.xlsx

Book2.xlsx

Book3.xlsx

Book4.xlsx

Find the intersection, union, and difference of all the data in Book[N].xlsx.

Write SPL script:

A1 List all Book[N].xlsx file names in order of file name

A2 Read the data in each Excel file in turn, and multiple copies of data form a set

A3 Multiple pieces of data, according to the team column to find the union, the results are as follows:

A4 Multiple pieces of data, calculate the intersection according to the team column, the result is empty.

A5 Multiple copies of data, calculate the difference set according to the team column, the results are as follows:

--

--