直接在公式里写关联

 

举例

Excel文件book1.xlsx中有员工就餐数据,部分数据如下所示:

..

现在要计算D列的员工餐费Meal charge,计算规则如下表所示:

..

编写SPL脚本:


A

1

=T("e:/work/book1.xlsx")

2

=A1.run('Meal   charge'=case(Grade,"manager":case('Meal type',"breakfast":20,"lunch":30,"supper":40),"chief":case('Meal   type',"breakfast":15,"lunch":20,"supper":25),"worker":case('Meal   type',"breakfast":10,"lunch":15,"supper":20)))

3

=T("e:/work/book2.xlsx",A1)

A1   读出book1.xlsx数据

A2   循环每条记录,根据GradeMeal type的值查询出Meal charge的值

A3   A1中的结果保存到文件book2.xlsx