Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Excel to csv batch script

AbhilashR
15 - Aurora
15 - Aurora

Hello, I am looking to build a solution that converts .xls file into .csv using batch scripts and run it via the Run Command tool. Has anyone implemented a similar solution and can share the script? I attempted implementing a few scripts I found on stackoverflow but ran into errors.

3 REPLIES 3
alexnajm
17 - Castor
17 - Castor

Could you use a batch macro to do so? Read in each .xls file and output to a .csv?

AbhilashR
15 - Aurora
15 - Aurora

I am looking to avoid a read/write of each file, so looking to avoid macros etc

urbot
7 - Meteor

Hi @AbhilashR 

 

here you go

 

Option Explicit

Dim objExcel, objWorkbook, objFSO, objOutputFile
Dim strExcelFile, strCSVFile

strExcelFile = "C:\path\to\your\excel_file.xls"
strCSVFile = "C:\path\to\your\csv_file.csv"

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(strExcelFile)

objWorkbook.SaveAs strCSVFile, 6 '6 represents the CSV file format

objWorkbook.Close False 'False means don't save changes
objExcel.Quit

Set objWorkbook = Nothing
Set objExcel = Nothing

 

Alteryx_workflow_to_write_output_in_xlsm_macro_workbook/xls_to_csv.vbs at main · U-rbot/Alteryx_work...

Labels