4.21 Aggregate files - same rows and columns

 

In practical business, sometimes we need to aggregate the data while merging multiple Excel files, for example:

Apple.xlsx
imagepng
Bread.xlsx
imagepng
Pork.xlsx
imagepng

Now we need to aggregate the Amount fields to form a column “total” amount , and store it to a new file. The result is as follows:

imagepng

Script:

A
1 =file(“Apple.xlsx”).xlsimport@t()
2 =file(“Bread.xlsx”).xlsimport@t()
3 =file(“Pork.xlsx”).xlsimport@t()
4 =A1.new(Name,Amount+A2(#).Amount+A3(#).Amount:TotalAmount)
5 =file(“TotalAmount.xlsx”).xlsexport@t(A4)