How to convert CSV files to Excel in bulk
CSV files are often used with accountants because the structure of functions and commands that have been done before are retained. Currently, CSV files can be opened in Excel, or open CSV files in Google Sheets easily. However, CSV file when working in Excel may encounter some errors such as Vietnamese error when opening the CSV file in Excel for example. So many people want to convert a CSV file to an Excel file to work more conveniently.
To convert a CSV file to Excel format there are many different ways to do it. If you want to batch convert CSV files to Excel, you can refer to the following article of Network Administration. With just a few simple steps, we now have XLS or XLSX Excel files easily, without the need for software support.
- How to convert a PDF file to Excel keeps the same format
- The simple way to convert XLSX files to XLS
- How to convert Excel files to Google Sheets
- How to delete table format in Excel
1. Convert CSV file to batch XLS file
Step 1:
First of all we will group the CSV files to be converted into XLS format into the same directory as the image below.
Step 2:
Next, users open Excel and then click on Developer tab and then on Visual Basic .
Step 3:
Switch to the new user interface, click Insert and then select Module to open the interface to enter the VBA code in Excel.
Then we paste the code below into the interface in Excel.
Sub CSVtoXLS() 'UpdatebyExtendoffice20170814 Dim xFd As FileDialog Dim xSPath As String Dim xCSVFile As String Dim xWsheet As String Application.DisplayAlerts = False Application.StatusBar = True xWsheet = ActiveWorkbook.Name Set xFd = Application.FileDialog(msoFileDialogFolderPicker) xFd.Title = "Select a folder:" If xFd.Show = -1 Then xSPath = xFd.SelectedItems(1) Else Exit Sub End If If Right(xSPath, 1) <> "" Then xSPath = xSPath + "" xCSVFile = Dir(xSPath & "*.csv") Do While xCSVFile <> "" Application.StatusBar = "Converting: " & xCSVFile Workbooks.Open Filename:=xSPath & xCSVFile ActiveWorkbook.SaveAs Replace(xSPath & xCSVFile, ".csv", ".xls", vbTextCompare), xlNormal ActiveWorkbook.Close Windows(xWsheet).Activate xCSVFile = Dir Loop Application.StatusBar = False Application.DisplayAlerts = True End Sub
Step 4:
Finally, click the Run icon in the upper toolbar as shown below to run VBA code.
Now display the folder on the computer so we can choose the folder containing the CSV file to move to Excel file, click OK. Soon VBA code will run and convert the file. At the end of the conversion process you open the previously saved CSV file folder.
Step 5:
As a result, we will see the XLS files as shown below.
2. Convert CSV file to XLSX file in batch
In addition to converting CSV to XLS as above we can also convert CSV files to XLSX easily. First, you also open VBA code editor in Excel and enter the code as shown below.
Sub CSVTOXLSX() 'UpdatebyExtendoffice20170814 Dim xFd As FileDialog Dim xSPath As String Dim xCSVFile As String Dim xWsheet As String Application.DisplayAlerts = False Application.StatusBar = True xWsheet = ActiveWorkbook.Name Set xFd = Application.FileDialog(msoFileDialogFolderPicker) xFd.Title = "Select a folder:" If xFd.Show = -1 Then xSPath = xFd.SelectedItems(1) Else Exit Sub End If If Right(xSPath, 1) <> "" Then xSPath = xSPath + "" xCSVFile = Dir(xSPath & "*.csv") Do While xCSVFile <> "" Application.StatusBar = "Converting: " & xCSVFile Workbooks.Open Filename:=xSPath & xCSVFile ActiveWorkbook.SaveAs Replace(xSPath & xCSVFile, ".csv", ".XLXS", vbTextCompare), xlWorkbookDefault ActiveWorkbook.Close Windows(xWsheet).Activate xCSVFile = Dir Loop Application.StatusBar = False Application.DisplayAlerts = True End Sub
Then click the Run button to run the VBA code.
When the conversion process is complete and open the folder containing the CSV file, you will see the converted XLXS files.
3. Convert the CSV file to Excel online
The online conversion tools now also support transferring multiple files at the same time, convenient for users to work. There are many file format conversion tools such as Onlineconvertfree for example.
We access the link below to open the CSV to XLS conversion right away. If you want to convert to XLXS, you only need to change the format conversion item. Then click Choose File to upload the CSV file.
https://onlineconvertfree.com/convert-format/csv-to-xls/
Finally click Convert to finish the conversion.
So we have ways to convert a series of CSV files into Excel files already. If you are not familiar with VBA code in Excel, you can use the online conversion tools also very useful.
I wish you successful implementation!
You should read it
- Simple way to convert Excel files to PDF
- How to convert Excel files to PDF online using Google Drive
- How to convert money into words in Excel, without an add-in, supports both 32-bit and 64-bit Excel
- How to Convert Measurements Easily in Microsoft Excel
- How to convert PDF files to Excel keeps formatting
- How to convert PDF to Excel
- How to convert columns into rows and rows into columns in Excel
- How to convert Office documents to PDF on Microsoft Office 2016
- How to convert Cad to Word, PDF, Excel
- How to use the Convert function on Excel
- Simple way to convert XLSX files to XLS
- Convert PDF to Word, convert PDF files for free