in reply to Loop through excel files and insert respective file name into cell within file
Take a look at Excel, especially Spreadsheet::WriteExcel.