Save Excel File (Workbook) as CSV (XLSX TO CSV)

Last Updated: October 23, 2023
puneet-gogia-excel-champs

- Written by Puneet

You can save an Excel file in different formats and from all those formats, CSV is quite popular. Yes, you can save your Excel file in CSV format (XLSX and CSV). CSV stands for comma-separated values where values are separated with commas as you can see in the following example.

save-excel-as-csv

Save an Excel File (Workbook) as a CSV (Comma Separated Values Format)

  1. First, open the file that you want to save in CSV format.
    open-file-to-save-as-csv
  2. After that, go to the File Tab, and click on the Save As option.
    click-save-as-option
  3. Now, specify the location where you want to save the file and from the “Save As Type” select “CSV UTF-8 (Comma Delimited)”
    select-csv-utf-8-to-save-file
  4. In the end, click OK to save the file.

Now here you can see you have both files (XLSX and CSV) saved on the desktop. But there is a slight difference between the icons that help you to identify which one is in the CSV format.

excel-xlxs-and-csv-icons

Now once, you save a workbook in CSV format, Excel still allows you to open it as it fully supports CSV format. But it won’t allow you to have formatting on the data and use features like formulas and functions.

Moreover, when you open the CSV file that you have just saved from Excel with a notepad application, you can see in the following example, it has commas between the values which we have as a table in the Excel format.

open-csv-with-notepad

There’s one thing that you need to know while converting your file from XLSX to CSV, if the workbook has more than one sheet, Excel will only save the current (active) sheet as CSV. It will ignore the rest of the sheets and you have to save them individually one by one.

excel-converts-current-sheet-to-csv-only

VBA Code to Convert an XLSX to CSV

You can also use the following VBA code to save an Excel file in CSV format.

Sub xlsx_to_csv()

Dim myPath As String, myName As String, myTime As String
Dim myAddress As String

myPath = ActiveWorkbook.Path
myName = Left(ActiveWorkbook.Name, InStr(ActiveWorkbook.Name, ".") - 1)
myTime = Format(Now, "DD_MM_YY_HH_MM_SS")
myAddress = myPath & "" & myName & "_" & myTime

ActiveWorkbook.SaveAs Filename:=myAddress, FileFormat:=xlCSVUTF8

End Sub

This code saves the active workbook as a CSV to the same location with the same name using the current date and time.