Export data to CSV produces incorrect csv file.
@@ -121,13 +121,17 @@ def dump_report_data(data, headers, title=None, fmt='', filename=None, append=Fa
csv_writer.writerow([])
elif append:
csv_writer.writerow([])
+
+ starting_column = 0
if headers:
- csv_writer.writerow(headers)
+ if headers[0] == '#':
+ starting_column = 1
+ csv_writer.writerow(headers[starting_column:])
for row in data:
for i in range(len(row)):
if type(row[i]) == list:
row[i] = '\n'.join(row[i])
- csv_writer.writerow(row)
+ csv_writer.writerow(row[starting_column:])
if filename:
fd.flush()
fd.close()
