Convert Excel To CSV using vbScript

Convert Excel to CSV

In this blog, we will see how to convert Excel to CSV using vbScript. How we can convert Excel file into CSV file easily by executing on simple vbScript?

This code will help you to convert your excel file to convert into csv format. Some CSV format might change due to records like date format(dd/mm/yyyy) and currency, etc.

Below is the sample Excel records which we have converted into CSV file-

Below is the Code to convert Excel to CSV using vbScript-

csv_format = 6
Set objectFSO = CreateObject("Scripting.FileSystemObject")
SRC_file = objectFSO.GetAbsolutePathName("C:\Users\porwa\Desktop\Book1.xlsx")
DEST_file = Replace(Replace(src_file,".xlsx",".csv"),".xls",".csv")
Dim ibExcel
Set ibExcel = CreateObject("Excel.Application")
Dim ibBook
Set ibBook = ibExcel.Workbooks.Open(SRC_file)
ibBook.SaveAs DEST_file, csv_format
ibBook.Close False

We hope you found this code useful. Just paste the above code in text file and save it as “ExcelToCSV.vbs”. Change the source file path as per your requirement.

Other related blog – Types of Flows in Power Automate

Like us on Facebook and Linkedin for more updates.

Back To Top