Script Convert Excel SS to CSV

March 3, 2008 at 13:56:25
Specs: Window XP Pro, Centrino/2GB
Hi,

I am fairly new at windows scripting, and am looking for some suggestion or code segments on how to go about writing a command line script to convert Excel SS to CSV files.

bd


See More: Script Convert Excel SS to CSV

Report •


#1
March 3, 2008 at 17:33:52
I am fairly new at windows scripting
Natively, there's VBScript, JScript, and Command Script. Office adds VBA. That doesn't even include the alternatives, like Power Shell scripts and Perl. You need to narrow it down a bit.

Excel SS
I know I'm missing something simple here, but the only thought this prompts is, "What does the Secret Service have to do with Excel?"


Report •

#2
March 3, 2008 at 20:32:44
Do you mean a VBA Macro which is run from Excel or a script running external to Excel?

Lionel Downunda (NZ)


Report •

#3
March 4, 2008 at 04:45:29
Thanks,

Basically, what I am trying to do is get the data from several 100 Excel Spreadsheets(SS) in a form that I can use it on a Unix platform. The catch is the only way the two system communicate is thru a firewall. I have the script for the unix half.

bd


Report •

Related Solutions

#4
March 4, 2008 at 18:59:54
Okay, to make this easy, I made this as a VBScript. It'll open every .xls file in the directory, then save it as <workbookName>.<sheetName>.csv:
Dim oFSO
Dim oShell, oExcel, oFile, oSheet
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
Set oExcel = CreateObject("Excel.Application")
oExcel.DisplayAlerts = False

For Each oFile In oFSO.GetFolder("C:\").Files
If LCase(oFSO.GetExtensionName(oFile)) = "xls" Then
With oExcel.Workbooks.Open(oFile, 0, True, , , , True, , , , False, , False)
For Each oSheet In .Worksheets
oSheet.SaveAs ".\" & oFile.Name & "." & oSheet.Name, 6
Next
.Close False, , False
End With
End If
Next
oExcel.Quit
oShell.Popup "Conversion complete", 10

The first red part (the C:\) is where the script will look for files.
The second red part (the .) is where the script will save the sheets.


Report •

#5
March 4, 2008 at 19:02:59
Have you tried to copy the files to the unix box and work with them directly instead of converting to csv files?

You didn't specify the type of script you're using, but Perl (which can be run on either system) can read/write MS Excel files.


Report •

#6
March 5, 2008 at 04:43:53
Perl was my first choice but the problem with the firewall it will only allow certian file types thru. And xls files are not one of them. That left me with waht Razor2.3 has graciously provided.

Thanks for the help


bd


Report •


Ask Question