Skip to main content

How to save / export only filtered data from Excel to csv file?

Author: Xiaoyang Last Modified: 2024-09-23

As we all known, it is easy for us to save a worksheet as csv file. But, have you ever tried to save only filtered data as csv file? Normally, the Save As feature In Excel will save the whole worksheet data as csv file, in this case, how could you save or export only filtered data from Excel to csv file?

Save / Export only filtered data from Excel to csv file with Copy Visible cells only

Save / Export only filtered data from Excel to csv file with VBA code

Save / Export only filtered data from Excel to csv file Kutools for Excel


Save / Export only filtered data from Excel to csv file with Copy Visible cells only

In Excel, you may not save the filtered data to csv file directly, but, you can finish it with a workaround, please do as follows:

1. Select the filtered data that you want to save.

2. Then click Home > Find & Select > Go To Special, see screenshot:

Go To Special option on the ribbon

3. In the Go To Special dialog box, choose Visible cells only option, see screenshot:

Go To Special dialog box

4. Then click OK button, and then copy and paste the filtered data to a new worksheet, and only the filtered data has been pasted into the new worksheet.

5. Now, you can save this new worksheet as csv file, please click File > Save As, in the Save As dialog box, specify a name and location for this file, and select CVS(Comma delimited) from the Save as type drop down list, see screenshot:

Save As dialog box

6. Then click Save to save this filtered data, and some warning messages will pop out, please click OK and Yes to close the messages, and then only the filtered data is saved as csv file in your selected directory.

Dialog box saying if you want to save only the active sheet

Arrow

Dialog box saying if you want to keep using that format


Save / Export only filtered data from Excel to csv file with VBA code

It may be an inefficient way by using the above method, here, I can create a VBA code for helping you export the filtered data to csv file quickly and conveniently.

1. Hold down the Alt + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following macro in the Module Window.

VBA code: Save / Export only filtered data from Excel to csv file

Sub Macro1()
'updateby Extendoffice
    Dim xRg As Range
    Dim xCell As Range
    Dim xAddress As String
    Dim xUpdate As Boolean
    Dim xFileName As String
    Dim xWb As Workbook
    On Error Resume Next
    xAddress = Application.ActiveWindow.RangeSelection.Address
    Set xRg = Application.InputBox("please select the filtered range", "Kutools for Excel", xAddress, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    Set xRg = xRg.SpecialCells(xlCellTypeVisible)
    If xRg Is Nothing Then Exit Sub
    xFileName = Application.GetSaveAsFilename(, "CSV Files (*.csv), *.csv", , "please specify the file name")
    If xFileName = "" Then Exit Sub
    xUpdate = Application.ScreenUpdating
    Application.ScreenUpdating = False
    xRg.Copy
    Set xWb = Application.Workbooks.Add
    xWb.ActiveSheet.Paste
    xWb.SaveAs Filename:=xFileName, FileFormat:=xlCSV, CreateBackup:=False
    xWb.Close False
    Application.ScreenUpdating = xUpdate
End Sub

3. Then press F5 key to run this code, and a prompt box is popped out to remind you select the filtered data that you want to save as csv file only, see screenshot:

Dialog to select the filtered data

4. Then click OK button, and another box is popped out to remind you specify a file name and a location for your csv file, see screenshot:

Dialog to specify a file name

5. And then click Save button, only the filtered data is saved as csv file.


Save / Export only filtered data from Excel to csv file Kutools for Excel

Kutools for Excel contains a useful tool-Export Range to File, it can help you export or save a range of selected cells to csv, pdf, text and other formatting files.

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Itegarate with AI capabilities, Kutools automates tasks with precision, making data management effortless. Detailed information of Kutools for Excel...         Free trial...

After installing Kutools for Excel, please do as follows:

1. Select the filtered data to export.

2. Click Kutools Plus > Import & export > Export Range to File, see screenshot:

Export Range to File option on the Kutools Plus tab on the ribbon

3. In the Export Range to File dialog box, choose the file format that you want to save under the File format, then then click File explorer button button to select a folder to save the exported file, see screenshot:

Export Range to File dialog box

4. Then click Ok button, and another prompt box is popped out to remind you type a name for your exported file, see screenshot:

Dialog box for entering a name for the file

5. And then click Ok, and only the selected filtered data has been saved as csv file as you need.

  Download and free trial Kutools for Excel Now!


Demo: Save / Export only filtered data from Excel to csv file Kutools for Excel

Kutools for Excel: Over 300 handy tools at your fingertips! Enjoy permanently free AI features! Download Now!

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!