Export Filtered Dataset to CSV

In my Perspective project, a dataset is generated based on a user input, which can then be exported to a CSV.

However, I also allow the user to "filter" the dataset by allowing them to select which columns they want visible. Essentially, this just makes the selected columns "NOT visible".

When exporting to CSV, the WHOLE dataset is exported, including the hidden columns. Is there any way to exclude these hidden columns?

If it is a dataset (not any array of data), then you can use the built-in system function for filtering columns:

It should then be straight forward enough to export it using system.dataset.exportCSV

2 Likes