Does anybody have an example of a xls-to-csv script?
I've never done scripting in Switch and don't know where to start!!
Thanks for any help
xls to csv script
Re: xls to csv script
Hello,
As there isn't any Excel connector (might I be wrong?), the only solutions I see are to either use a command line utility :
http://www.maketecheasier.com/convert-x ... mand-line/
or
Use a script element and some os language (VB or APS) to drive excel and get the CSV exported.
FWIW,
Loic
http://www.ozalto.com
As there isn't any Excel connector (might I be wrong?), the only solutions I see are to either use a command line utility :
http://www.maketecheasier.com/convert-x ... mand-line/
or
Use a script element and some os language (VB or APS) to drive excel and get the CSV exported.
FWIW,
Loic
http://www.ozalto.com
Re: xls to csv script
Just as an option I am successfully using a command line tool called xlsx2csv to perform these types of conversions in Switch.
Just Google xlsx2csv.
Hope this helps.
Just Google xlsx2csv.
Hope this helps.
Regards,
William Buckingham
William Buckingham
Re: xls to csv script
I can get the script to work via a terminal window but not within the command line.
I've set the path to the script, but do I need to enter %1 %2 %3 data as the script is self-contained?
I've set the path to the script, but do I need to enter %1 %2 %3 data as the script is self-contained?
Re: xls to csv script
Hi,
I ended up using the Execute Command option with a Python script.
Command: /usr/bin/python
Arguments: /Users/admin/Documents/PythonScripts/xls_to_csv.py
The script uses static input and output name (FileA in the example below)
#! /usr/bin/env python
import xlrd
import csv
book = xlrd.open_workbook('/Users/admin/Documents/PythonScripts/FileA.xls')
# Assuming the fist sheet is of interest
sheet = book.sheet_by_index(0)
# Many options here to control how quotes are handled, etc.
csvWriter = csv.writer(open('/Users/admin/Documents/PythonScripts/FileA.csv', 'w'), delimiter=',')
for i in range(sheet.nrows):
csvWriter.writerow(sheet.row_values(i))
How do I change this to work with variable file names instead ie %1 %2?
I've read about it but never got it to work.
Could somebody help me please?
I ended up using the Execute Command option with a Python script.
Command: /usr/bin/python
Arguments: /Users/admin/Documents/PythonScripts/xls_to_csv.py
The script uses static input and output name (FileA in the example below)
#! /usr/bin/env python
import xlrd
import csv
book = xlrd.open_workbook('/Users/admin/Documents/PythonScripts/FileA.xls')
# Assuming the fist sheet is of interest
sheet = book.sheet_by_index(0)
# Many options here to control how quotes are handled, etc.
csvWriter = csv.writer(open('/Users/admin/Documents/PythonScripts/FileA.csv', 'w'), delimiter=',')
for i in range(sheet.nrows):
csvWriter.writerow(sheet.row_values(i))
How do I change this to work with variable file names instead ie %1 %2?
I've read about it but never got it to work.
Could somebody help me please?