Skip to main content

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

Author: Xiaoyang Last Modified: 2020-05-07

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


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:

doc save filtered data as csv 1

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

doc save filtered data as csv 2

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:

doc save filtered data as csv 3

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.

doc save filtered data as csv 4

 1

doc save filtered data as csv 5


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:

doc save filtered data as csv 6

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:

doc save filtered data as csv 7

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


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 : with more than 300 handy Excel add-ins, free to try with no limitation in 30 days.

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:

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 doc save filtered data as csv 10 button to select a folder to save the exported file, see screenshot:

doc save filtered data as csv 9

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

doc save filtered data as csv 11

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 !


Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days. Download and free trial 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

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...

Description


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!
Comments (1)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Thank you for saving me with this info!! Greetings from Mexico
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations