This works, but you can also perform this by converting the array into a spreadsheet string, concatenating this with the header string, and then write the string file. I have used this method and found it to work quite well. It works for inserting both full lines of text or for inserting column headings. If you insert column headings make sure that the delimiters are the same as the data if you want to import the data into some other software.
John