Forum Discussion

doc0297's avatar
doc0297
Copper Contributor
Apr 01, 2026

How to keep just the filtered data when saving

I have a .csv that has multiple items that I don't need.  After running my filter and then saving, everytime I reopen or share the file, all the original data is there again.  How do I keep just the data I have filtered?

1 Reply

  • m_tarler's avatar
    m_tarler
    Silver Contributor

    so there are a number of things here. the main thing is that it is a .csv file so it will NOT save any formatting, filtering, etc it will only save the data itself.  This could be good as you won't have 'hidden' data that a user could just unhide.  

    As for how to get this done, I have to next ask what you mean when you say "after running my filter" and what exactly that means.  is that a macro/VBA/script?  is that using the quick filters in excel? is that using advanced filters in excel?  is that hiding rows/columns and not using data filters?  I ask because 'hiding' rows/columns won't work but 'filtering' rows will work with the method below:

    So if you use an excel filter (like the quick filters or advanced filter or a macro that applies these methods) you should be able to copy the resulting 'table' and then paste it in a new location then delete the orginal data range.  So for example original data is in rows 1:100 and you filter the data and then copy that range and paste it starting in row 110.  Then highlight rows 1:109 and right click and hit delete rows.  OR paste the data in a new sheet tab and delete the original tab.  Then save the .csv and you will have permenantly removed that unwanted data.

    If you are manually hiding rows or columns, choose to Delete those rows or columns instead.  If it is a macro or VBA then have that code delete instead of hide.

    Hope that helps