Since you said the columns aren't always the same or in order, I'd recommend Data::TableReader to do the work of extracting the ones you care about, and then you can use a variation of your write_excel to write them by name.
Also take a look at Data::Table which makes writing and reading very convenient.