Sorry to pull up this old thread, but this script does exactly what I require. So thanks for this.
However, is it possible to change the value of "column" + index below to be the contents of the first cell in the column, i.e. the column heading, so that the exported .txt file will be named correctly rather than 'Column0.txt' etc. Hope so, and thanks for any help that anybody might offer.
folder.createFile("column" + index + ".txt", column.join("\n"));