Page 1 of 1 1
Topic Options
#212457 - 2017-04-24 12:37 PM .xls convert to .csv
Sweeny Offline
Fresh Scripter

Registered: 2016-03-18
Posts: 18
Loc: Hampshire
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

Top
#212458 - 2017-04-24 12:50 PM Re: .xls convert to .csv [Re: Sweeny]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
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
_________________________
Actually I am a Rocket Scientist! \:D

Top
#212459 - 2017-04-24 12:54 PM Re: .xls convert to .csv [Re: Glenn Barnas]
Sweeny Offline
Fresh Scripter

Registered: 2016-03-18
Posts: 18
Loc: Hampshire
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

Top
#212460 - 2017-04-24 04:02 PM Re: .xls convert to .csv [Re: Sweeny]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
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

Top
#212462 - 2017-04-24 11:06 PM Re: .xls convert to .csv [Re: ShaneEP]
Sweeny Offline
Fresh Scripter

Registered: 2016-03-18
Posts: 18
Loc: Hampshire
Thank you all for your help, I now have a working solution and am indebted to you both
Many thanks,
Tom

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 686 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.055 seconds in which 0.024 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org