What Is UTF-8 Encoding?
The UTF-8 encoding is the most used character encoding for the internet. It is used in emails and web pages. It allows access to both Unicode standard characters and ASCII characters.
How to Apply UTF-8 Encoding on a CSV File in Excel: 2 Ways
Method 1 – Using the Save As Command
Steps:
- Open the CSV file in Excel.
- Go to the File tab.
- Choose the Save As command.
- From the drop-down list, choose CSV UTF-8 (Comma Delimited) (*.csv) option.
- Click on Save.
Read More: [Fixed!] CSV UTF 8 Not Available in Excel
Method 2 – Applying VBA to Encode a CSV File
Steps:
- Go to the Developer tab and select Visual Basic.
- The VBA editor will appear.
- Select Insert and choose Module to open a VBA Module.
- Enter the following code in the Module and Save the code.
Sub EncodingToUTF8()
Dim AM_WS As Worksheet
Dim AM_Path As String
Application.ScreenUpdating = False
AM_Path = ActiveWorkbook.Path & "\" & _
Left(ActiveWorkbook.Name, InStr(ActiveWorkbook.Name, ".") - 1)
For Each AM_WS In Worksheets
AM_WS.Copy
ActiveWorkbook.SaveAs Filename:=AM_Path & "_" & AM_WS.Name _
& ".csv", FileFormat:=xlCSVUTF8, CreateBackup:=False
ActiveWorkbook.Close False
Next
Application.ScreenUpdating = True
End Sub
We named the Subroutine as EncodingToUTF8. The first variable is AM_WS which is a Worksheet variable. The second one is AM_Path and it is a String type variable. In the next few lines, the code takes each worksheet and changes its name to Workbook name_Worksheet name.csv in this format. The FileFormat:=xlCSVUTF8 line encodes each CSV file with UTF-8 encoding.
- Click the Run button.
- All the sheets will be converted.
Read More: How to Encode Data in Excel
How to Open a UTF-8 Encoded CSV File in Excel Without Changing the Language Format
Steps:
- Go to the Data tab.
- Click on the Get Data command.
- From the drop-down, select From File.
- Select From Text/CSV.
- Select the CSV file and click on Import.
- A new window will appear on the screen.
- Under the File Origin, choose 65001:Unicode (UTF-8).
- Select a Comma as the Delimiter.
- Click on Load.
- The CSV file data will be loaded to Excel without any change in formatting.
Read More: How to Change Encoding in Excel
Download the Practice Workbook
Related Articles
<< Go Back to Excel Encoding | Excel Files | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!