5.1 Split by row - by number of rows

 

We have an order table file Orders.xls, and part of the data is shown in the figure below. The first row contains the column titles, and the data start from the second row with one piece of data per row.

imagepng

Now we need to split this file into several small files by the specified number of rows. The split result is shown as follows:

Orders1.xlsx:

imagepng

Orders2.xlsx:

imagepng

Orders3.xlsx:

imagepng

Script:

A B
1 =T@c(“Orders.xlsx”)
2 for A1,300 =T(“Orders”/#A2/“.xlsx”,A2)

A1: Read the data of Orders.xlsx file as a cursor, the @c option means reading as a cursor.

A2: Loop through the data in A1, fetching 300 pieces of data each time.

B2: Take Orders + loop sequence number as the file name, and write the data in A2 to the file.