In this article, we are going to show you how you can convert a CSV file to an Excel workbook. For that, we will be using a VBScript. Let us check out the script and steps that you need for conversion.
How to Convert CSV to Excel using Command line
Here are the steps to convert CSV to Excel using Command Line Interface in Windows 11 or Windows 10: Let’s discuss these steps in detail! Firstly, open the Notepad application on your Windows 10 PC. You now have to write a VBScript with related commands. Below is the full script that you need to enter in the Notepad; just copy from here and paste it into your Notepad: After entering the above script, you need to save the file with the .vbs file extension. For that, click on the File > Save As option. In the Save As dialog prompt, set Save As Type to All Files and then enter the filename followed by the .vbs file extension. After that, click on the Save button to save the VBS file.
Now, go to the folder where you have saved the above VBS script and open Command Prompt in this folder. Next, you have to enter a command with the below syntax in CMD: Let’s say you have named the VBS file as “csv-to-excel”, then your command will look something like the below one: In case you want to create an Excel file with the older file extension i.e., XLS, just replace xlsx with xls. Here is an example: Do remember that you have to mention the full path of both input CSV and output Excel files.
As you enter the above command, you will get the output Excel file.
In the above VBScript, there are options to adjust column width, freeze pane, apply filter, make header bold, etc. You can easily tweak the VBScript to customize these options and then run the command to convert CSV to Excel through CMD. If you are a programmer, you can further customize the script accordingly. So, this is how you can convert CSV to Excel using Command-Line with help of a VBScript created by Jeff. Related reads:
How to convert DBF to Excel in WindowsHow to convert a Text (TXT/CSV) file into an Excel fileFree Batch PDF to Excel Converter Software.