I think I'd use the CSV library to generate this.