in reply to Textfile to csv with a small twist

Two things I don't understand: 1) how do you recognize a heading? A hard-coded list? Anything with a trailing colon? Something else? 2) What do you want the table structure to be? I understand the headings are columns, but what about the rows? Is it like this or something else:
     heading1 | heading2
     ---------+---------
     text1    | text1
     text2    | text2