5.5 Split by row - generate one card per row

 

There is an employee information table Employee.xlsx, and part of the data is as follows:

imagepng

Now we want to split the data to generate one card-style table for each employee in the following format, and the empty card-style file is named Card.xlsx:

imagepng

The generated card-style file is named after employee name, such as:

Andrew.Fuller.xlsx:

imagepng

Janet.Leverling.xlsx:

imagepng

Margaret.Peacock.xlsx:

imagepng

Nancy.Davolio.xlsx:

imagepng

Script:

A B C
1 =T(“Employee.xlsx”) [B1,B2,D2,D1,B3,B4,B5,B7,B6]
2 for A1 =file(“Card.xlsx”).xlsopen()
3 for C1 =B2.xlscell(B3,1;A2.field(#B3))
4 =file(A2.FirstName+“.”+A2.LastName+“.xlsx”).xlswrite(B2)

A1:  Read the data of employee information table.

C1:  Define the sequence of cell names where each column of the employee information table is to be written on the card.

A2: Loop through every employee.

B2: Open the empty card-style file as an Excel object.

B3: Loop through each cell to be filled in.

C3: Fill the content of the corresponding column number in the current employee A2 into the current to-be-written cell.

B4: Store the Excel object of B2 to the Excel file named after the employee’s name.


esProc Desktop and Excel Processing
5.4 Split by row - segment by data (by filtering condition)
5.6 Split by row - split multiple cards to make one card generate one file