Exporting dataset to CSV results in extra rows with #NAMES & #TYPES

I have a button script that uses system.tag.queryTagHistory and assigns the results to a custom property on root. My export script looks like this:

data = self.view.getChild("root").custom.data
csv = system.dataset.toCSV(data, True, True)
system.perspective.download('data_export.csv', csv)

The resulting export has additional rows as seen below.

"#NAMES"
"t_stamp","POI/SEL735/Voltage A"
"#TYPES"
"java.sql.Timestamp","D"
"#ROWS","1057"
"2024-02-23 13:00:00.972","20.496688842773438"
"2024-02-23 13:00:02.983","20.49338150024414"

the binding can be seen here:

image

That's what the forExport parameter you set to True does.

5 Likes

Thanks Kevin! That did it!