How to Apply UTF 8 Encoding on CSV File in Excel

In this article, we will talk about how to apply UTF 8 encoding on a CSV file in Excel. Thus, users will be able to encode the CSV file and transfer it to the world wide web. The UTF 8 encoding covers a wide range of characters even from various languages. So, the UTF 8 encoding is very effective in communication as well.


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. The UTF 8 encoding not only allows access to Unicode standard characters but also ASCII characters. Thus, it allows users to accurately represent any character of any language.


How to Apply UTF 8 Encoding on CSV File in Excel: 2 Ways

In this article, we will show 2 ways to apply UTF 8 encoding on a CSV file in Excel. Firstly, we will use the Save As command of Excel to do so. We will use a VBA code to allow UTF 8 encoding for multiple Excel sheets.

1. Using Save As Command

In this method, we will save a CSV file with UTF 8 encoding. We will change the format of the file by using the Save As command and encode the file with UTF 8 encoding.

Steps:

  • Open the CSV file in the Excel application.
  • Go to the File tab.

going to file tab to apply utf 8 encoding on csv file in excel

  • Choose the Save As command.
  • From the drop-down list, choose CSV UTF-8 (Comma Delimited) (*.csv) option.
  • Finally, click on Save.

using save as command to apply utf 8 encoding on csv file in excel

Thus, the CSV file will be UTF 8 encoded.

Read More: [Fixed!] CSV UTF 8 Not Available in Excel


2. Applying VBA to Encode CSV File

In this instance, we will use a simple VBA code to encode multiple Excel sheets into CSV with UTF 8 encoding. Thus, all the sheets will turn into individual CSV files with UTF 8 encoding.

Steps:

  • Go to the Developer tab and select Visual Basic.

going to visual basic module to apply utf 8 encoding on csv file in excel

  • The VBA editor will appear. Select Insert >> 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

writing and saving code to apply utf 8 encoding on csv file in excel

Here, we named the Subroutine as EncodingToUTF8. Then, we declared two variables. 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. Finally, the FileFormat:=xlCSVUTF8 line encodes each CSV file with UTF 8 encoding.

  • Next, click the Run button.

running vba code to apply utf 8 encoding on csv file in excel

  • All the sheets will turn into UTF 8 encoded CSV files.

using vba code to apply utf 8 encoding on csv file in excel

This is how the Excel sheets will turn into UTF 8 encoded CSV files.

Read More: How to Encode Data in Excel


How to Open UTF-8 Encoded CSV File in Excel Without Changing Language Format

It often happens that one opens a CSV file containing characters from different languages in Excel and the language format of that file changes. This is not expected at all. In this method, we will use the Get Data command to open the CSV file without changing the language format.

Steps:

  • Go to the Data tab.
  • Then, click on the Get Data command.
  • From the drop-down, select From File.
  • Next, 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.
  • Finally, click on Load.

  • As a result, the CSV file data will be loaded to Excel without any change in formatting.

Read More: How to Change Encoding in Excel


Download Practice Workbook


Conclusion

In this article, we have discussed 2 ways to apply UTF 8 encoding on a CSV file in Excel. These methods will allow users to encode their CSV files and share the files with other users without any difficulties. If you have any questions regarding this essay, feel free to let us know in the comments. Also, if you want to see more Excel content like this, please visit our website and unlock a great resource for Excel-related content.


Related Articles


<< Go Back to Excel Encoding | Excel Files | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Adnan Masruf
Adnan Masruf

Adnan Masruf, holding a BSc in Naval Architecture & Engineering from Bangladesh University of Engineering and Technology, plays a pivotal role as an Excel & VBA Content Developer at ExcelDemy. His deep passion for research and innovation seamlessly aligns with his dedication to Excel. In this capacity, Masruf not only skillfully addresses challenging issues but also exhibits enthusiasm and expertise in gracefully navigating intricate situations, underscoring his steadfast commitment to consistently delivering exceptional content. His interests... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo