Skip to main content

How to save or export each sheet as CSV/PDF file in Excel?

For example you have a large workbook with multiple sheets, and you want to save or export each sheet as an individual .csv file or PDF file, how to get it done easily and quickly? In this article, I will introduce several methods to solve it.


Save or export each sheet as CSV/PDF file with Save As feature

As you know, Microsoft Excel can save current worksheet as an individual .csv file or PDF file. Therefore, you can save or export every sheet as .csv file or PDF file one by one manually.

1. Switch to the sheet that you will save or export as an individual .csv file, and click File (or Office button) > Save As.

2. In the opening dialog box, specify the destination folder that you will save the .csv file into, click the Save as type box and select CSV (Comma delimited) (*.csv) or PDF (*.pdf) from the drop down list, and click the Save button.

3. There will be two warning dialog boxes coming out successively. Please click OK > Yes.

Note: If you save active worksheet as PDF file, these dialog boxes won't pop up. Just go ahead to next step.

4. Repeat above step 1-3 to save other sheets as individual .csv files one by one.


Batch save or export each sheet as CSV file with VBA

If there are a number of sheets that you want to save or export as .csv files, the first method will be quite time-consuming and tedious. This VBA can simplify working and make it easy to save or export each sheet as .csv file.

1. Press Alt + F11 keys simultaneously to open the Microsoft Visual Basic for Application window.

2. Click Insert > Module, and then paste following VBA code into the new module window.

VBA: Save every sheet as an individual CSV file

Public Sub SaveWorksheetsAsCsv()
Dim xWs As Worksheet
Dim xDir As String
Dim folder As FileDialog
Set folder = Application.FileDialog(msoFileDialogFolderPicker)
If folder.Show <> -1 Then Exit Sub
xDir = folder.SelectedItems(1)
For Each xWs In Application.ActiveWorkbook.Worksheets
xWs.SaveAs xDir & "\" & xWs.Name, xlCSV
Next
End Sub
3. Click the Run button or press F5 key to run this VBA.

4. In the opening Browse dialog box, specify the destination folder that you will save all .csv files into, and click the OK button.

Then you will see every sheet is saved/exported as an individual .csv file in the specified destination folder.


Batch save or export each sheet as CSV/PDF file with Kutools for Excel

Some Excel users may refuse VBA code for some reasons. Do not worry! The third method can also batch save or export each sheet as .csv file or PDF file easily by the Split Workbook utility of Kutools for Excel.

Kutools for Excel - Supercharge Excel with over 300 essential tools. Enjoy a full-featured 30-day FREE trial with no credit card required! Get It Now

1. Click the Enterprise > Workbook > Split Workbook.

doc each sheet to csv 2

2. In the opening Split Workbook dialog box,

doc each sheet to csv 8

(1) Keep selecting all sheets. If not, you can check the checkbox before Worksheet name to select all sheets;

(2) Check the Specify save format option;

(3) Click the box below Specify save format option, and select CSV (Macintosh)(*.csv) or PDF (*.pdf) from the drop down list.

(4) Click the Split button.

 

Note: If there are hidden and blank worksheets existing in your workbook, checking the Skip hidden worksheets box and the Skip blank worksheet box will ignore all blank or hidden sheets while exporting.

Kutools for Excel - Supercharge Excel with over 300 essential tools. Enjoy a full-featured 30-day FREE trial with no credit card required! Get It Now

3. In the opening Browse for Folder dialog box, specify the destination folder that you will save all .csv file or PDF file into, and click the OK button.

Now you will see every sheet is exported and saved as an individual .csv file in the specified folder.


Demo: save or export each sheet as CSV/PDF file in Excel


Kutools for Excel: Over 300 handy tools at your fingertips! Start your 30-day free trial with no feature limitations today. 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

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 (7)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Thank you so much - the VBA soultion worked great and saved me a ton of time!
This comment was minimized by the moderator on the site
Hello, thank you for these tips! I tried using the VBA code but I'm getting a run-time error code 91 for the following syntax:

If folder.Show <> -1 Then Exit Sub

Can you help me troubleshoot? I'm new to VBA. :)
This comment was minimized by the moderator on the site
Hi there,

Please make sure that there is only the VBA code from this tutorial in your Module window. If there are other codes, please delete or move them to a new module.

After that, please run the code. If it's still not working, please use the code below:
Public Sub SaveWorksheetsAsCsv()
Dim xWs As Worksheet
Dim xDir As String
Dim folder As FileDialog
On Error Resume Next
Set folder = Application.FileDialog(msoFileDialogFolderPicker)
If folder.Show <> -1 Then Exit Sub
xDir = folder.SelectedItems(1)
For Each xWs In Application.ActiveWorkbook.Worksheets
xWs.SaveAs xDir & "\" & xWs.Name, xlCSV
Next
End Sub


Amanda
This comment was minimized by the moderator on the site
How to keep and maintain decimals values when exporting excel sheets to CSV? financial data requires accuracy of data till 3 decimals when export to CSV? please advise
This comment was minimized by the moderator on the site
Hi prashan9810,
Before exporting the sheets from Excel to CSV, you’d better change the formatting of currency numbers, and fix their decimal places to 3.
You can change the decimal places as follows:
1. In Excel, select the currency cells, right click, and select Format Cells from the context menu.
2. In the Format Cells dialog, select Currency or Accounting in the Category list box, enter 3 in the Decimal places box, and click OK.
This comment was minimized by the moderator on the site
Thank you for your very helpful tips. I used the vba code to convert an excel file with multiple sheets into individual csv files. I'm wondering, how can I specify that i'd like those csv files to be utf-8? Is there an addition to the code below that will add that feature? Public Sub SaveWorksheetsAsCsv() Dim xWs As Worksheet Dim xDir As String Dim folder As FileDialog Set folder = Application.FileDialog(msoFileDialogFolderPicker) If folder.Show -1 Then Exit Sub xDir = folder.SelectedItems(1) For Each xWs In Application.ActiveWorkbook.Worksheets xWs.SaveAs xDir & "\" & xWs.Name, xlCSV Next End Sub
This comment was minimized by the moderator on the site
ActiveWorkbook.SaveAs Filename:=Replace(Replace(xSPath & xCSVFile & xWs.Name, ".xlsx", "", vbTextCompare), ".xls", "", vbTextCompare) & ".csv", FileFormat:=xlCSVUTF8, CreateBackup:=False
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations