5.8 Split by column - by column - take column name as file name

 

There is a file Amount.xlsx as shown below:

imagepng

This is an amount summary table for certain products purchased by some key customers. Now we need to split it by product, and save each product as a file with the product name as the file name and Amount as the column name. The split results are as follows:
Apple.xlsx:

imagepng

Bread.xlsx:

imagepng

Pork.xlsx:

imagepng

Script:

A B
1 =T(“Amount.xlsx”) =A1.fname()"Name"
2 for B1 =A1.new(Name,${A2}:Amount)
3 =T(A2+“.xlsx”,B2)