Well, this is not a Spreadsheet::WriteExcel specific answer, but here we go. If you are writing sheet one, you have access to all of the values, as you are probably iterating over them to write the sheet. If I were you, I would keep track of the values in a hash of hashes as I wrote them to sheet one, first keyed on file name, and then on error code. Then, to write sheet two, traverse your HoH and write the appopriate cells in to the sheet.