How to output multiple excel files?

Below is a dataset that I will read into Pipeline Pilot. I would like to output records with the same file name into one excel file. So, there will be 2 output files. One file is named 'male.xlsx' that will contains 3 rows of data. The other excel file is named 'female.xlsx' that will contain 2 rows of data. Is there any ways that I could do this? I will appreciate any help. Thanks!

Inputs: (one dataset that contains 4 columns)

Name     Gender  Age    filename
Curtis         M       18     male.xlsx
Frank          M       40     male.xlsx
Feng           M       35     male.xlsx
Alice           F       36     female.xlsx
Anna           F       25     female.xlsx

Outputs:  (two datasets)

male.xlsx  (contains 3 records)

female.xlsx (contains 2 records)