Sweeny
(Fresh Scripter)
2017-04-24 12:37 PM
.xls convert to .csv

To the good and knowledgeable people of the Kixtart forum,
I am hoping to convert a file of .xls format to a .csv format. I believe this can be achieved by using COM Objects, I am however confused by the syntax. Can someone assist me in where to start please? \:\)
Many thanks,
Tom


Glenn BarnasAdministrator
(KiX Supporter)
2017-04-24 12:50 PM
Re: .xls convert to .csv

Have you looked at the Kix XLSlib function library?

The most current version is on my web site - you can grab the individual UDF library or a zip of every function in the library. You can open and save (which might be all you need) as well as perform a wide array of data manipulation tasks with the library without having to re-invent the wheel.

Glenn


Sweeny
(Fresh Scripter)
2017-04-24 12:54 PM
Re: .xls convert to .csv

Hi Glenn,

No I haven't seen that library, can I ask where I would find that please? Thank you for the swift reply \:\)

Cheers,

Tom


ShaneEP
(MM club member)
2017-04-24 04:02 PM
Re: .xls convert to .csv

This seems to work fine.
 Code:
Break On

$xlsFileName = @ScriptDir+"\test.xlsx"
$csvFileName = @ScriptDir+"\test.csv"

$oXL = CreateObject("EXCEL.Application")
$oXL.DisplayAlerts = False
$oXLFile = $oXL.WorkBooks.Open($xlsFileName)
$nul = $oXL.ActiveWorkBook.SaveAs($csvFileName, 6)

$oXL.Quit
$oXL = 0


Sweeny
(Fresh Scripter)
2017-04-24 11:06 PM
Re: .xls convert to .csv

Thank you all for your help, I now have a working solution and am indebted to you both
Many thanks,
Tom