Sounds more like an issue with the output engine than with your data structure. For an alternative, you might like to check out Spreadsheet::HTML by jeffa.
The way forward always starts with a minimal test.
Comment on Re: Removing empty elements from multi-dimensional array