in reply to How to write to a excel file while downloading in cgi perl

If the code writing to the Excel file is already written, why don't you apply your changes there, before calling $workbook->close?

Alternatively, (re)open the workbook, make your changes, and then save it to a tempfile, and send that tempfile to the user.

Also see Spreadsheet::ParseExcel::SaveParser.