How to save / export only filtered data from Excel to csv file?
When working with large datasets in Excel, it's common to apply filters to focus on specific subsets of your data. However, there are times when you may want to save or export only the filtered (visible) rows to a separate CSV file for reporting, data exchange, or further analysis. By default, Excel’s Save As function will export the entire worksheet—including all hidden and filtered-out rows—when saving to a CSV file. This can create problems if you wish to isolate and export only the results of your filter, leaving out the data you don’t need at that moment.
In the following sections, you’ll find several practical methods for exporting only the filtered data to a CSV file in Excel. Each method provides advantages and is suitable for different user needs and scenarios. Read through and choose the solution that best fits your workflow and Excel proficiency:
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
Export Filtered Data via Power Query
Save / Export only filtered data from Excel to csv file with Copy Visible cells only
Excel does not natively allow you to directly save only filtered (visible) rows as a CSV file. However, you can use a simple workaround to achieve your goal. This approach is suitable for those who prefer to avoid complex functions or coding. Below are the detailed steps:
1. After applying the filter to your worksheet, select the range of filtered data you want to save. Ensure that you include the header row (if needed) for clarity in the exported file.
2. On the ribbon, go to Home > Find & Select > Go To Special. This option helps you select only the visible cells. See screenshot:
3. In the Go To Special dialog box, select the Visible cells only option. This ensures that only the displayed (filtered) rows will be selected, and hidden rows will not be copied by accident.
4. After clicking OK, copy the selected range (you can press Ctrl+C or right-click and choose Copy), then open a new worksheet and paste your data (using Ctrl+V). Only the visible (filtered) rows will appear—hidden rows are excluded, so your dataset is now ready to be exported.
5. To export this data, go to File > Save As. In the Save As dialog box, select the desired file name and location. From the Save as type dropdown list, choose CSV (Comma delimited) (*.csv). See screenshot for guidance:
6. Click Save. You may receive a popup warning that "Some features in your workbook might be lost" or asking if you want to save only the active sheet. This is standard for CSV export. Please confirm by clicking OK and then Yes. Your filtered data is now saved as a CSV file located in your chosen directory.
This method is straightforward and requires no coding skills. However, it can be slightly time-consuming if you have to repeat it often or work with very large datasets. Always double-check the pasted data in the new worksheet before saving, to confirm that only the visible rows have been included. If you need to frequently export filtered data, consider the automation methods below.
Save / Export only filtered data from Excel to csv file with VBA code
If you deal with filtered data exports on a regular basis or want a faster, automated approach, you can make use of a VBA macro. This is particularly suitable if you want to reduce manual steps and export ranges programmatically. Below is a step-by-step guide:
1. Press Alt + F11 to open the Microsoft Visual Basic for Applications (VBA) editor. This opens a new window where you can manage your Excel macros.
2. In the VBA editor, click Insert > Module to add a new module. Copy and paste the following VBA code into the empty 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. With the code in place, press F5 or click the Run button to execute. You will see a prompt asking you to select the filtered data range that you want to export as a CSV file. Use your mouse to select the relevant cells and click OK.
4. Next, another dialog box appears prompting you to specify the file name and storage location for your CSV. Choose or create your destination directory and enter a file name, as shown:
5. Click Save and the macro will export only the visible cells in your selection to a CSV file. Hidden rows—those filtered out—will not be included.
This VBA solution is quick, accurate and perfect for repetitive tasks or bulk exports. However, you’ll need basic familiarity with enabling macros and using the VBA editor. Always make sure to save your work and keep backups of important files before running new macros. Should you encounter errors, check that your selection contains visible cells (filtered data) and that you have permission to write to the selected directory.
Save / Export only filtered data from Excel to csv file Kutools for Excel
Kutools for Excel provides a dedicated feature called Export Range to File. This utility makes it much easier to export selected cells—including filtered data—to a CSV, PDF, text, or other formats. This is an ideal choice for users who want a reliable solution without having to use VBA code or manual selection, especially if exporting filtered data is a common task in your workflow.
If you have installed Kutools for Excel, follow these steps:
1. First, apply your desired filter and select the visible data you wish to export. Make sure only the relevant (filtered) rows are included in your selection.
2. Go to Kutools Plus on the ribbon, select Import & export, and then Export Range to File. Refer to the screenshot below for locating this option:
3. In the Export Range to File dialog, select the file format (e.g., CSV) from the File format section. Click to browse and select a folder for saving the exported file. See example below:
4. After confirming the location and settings, click Ok. Another prompt will appear asking you to name your exported file. Enter the desired name and confirm.
5. Click Ok once again. The selected filtered data will be saved as a CSV file in your chosen location. Only the visible cells you selected are exported—hidden rows are ignored.
Using Kutools for Excel is highly recommended for users who perform repeated exports, require flexible format options, or are less experienced with VBA. In addition to CSV, you can export directly to text, PDF and several other formats, saving you time and reducing the risk of errors in manual operations.
Download and free trial Kutools for Excel Now!
If you ever encounter unexpected results or files missing data, verify that your selection contained only the intended visible cells before exporting. Also, pay attention to folder permissions and file format settings in the dialog to avoid common issues.
Demo: Save / Export only filtered data from Excel to csv file Kutools for Excel
Export Filtered Data via Power Query
Power Query (Get & Transform) can be used to extract and save filtered data. This method is suitable for users using modern Excel versions (Excel2016 and later) and who wish to automate repeatable exports:
1. Select your data and go to Data > From Table/Range to launch Power Query Editor (your range must have headers).
2. In Power Query, apply your desired filter directly to the relevant columns.
3. Click Home > Close & Load To and choose “Only Create Connection” or “Table in new worksheet.”
4. The filtered results now appear in a new worksheet. Export as usual (File > Save As > CSV).
Power Query is practical for users who need scheduled data exports or want to create reusable query templates. The initial setup may be more complex for beginners, but it is highly efficient for dataset transformations and repeat use.
Best Office Productivity Tools
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!
All Kutools add-ins. One installer
Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.





- All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
- One installer, one license — set up in minutes (MSI-ready)
- Works better together — streamlined productivity across Office apps
- 30-day full-featured trial — no registration, no credit card
- Best value — save vs buying individual add-in