in reply to
Spreadsheet::WriteExcel - writes the header but no subsequent rows
I can't be too sure but it sounds like you may be flattening an array when passing it into a sub routine i.e instead of passing an array by reference you are actaually passing it as the array and so the sub routine reads only the first few values.
From a quick look thru it looks like $header is a suitable candidate. Although as you use the same variable name in a few places it is not so easy to tell.
Hope that helps.