[Info-vax] PERL for OpenVMS Alpha that will install on V8.4
Paul Sture
nospam at sture.ch
Mon Dec 2 08:17:07 EST 2013
VAXman- at SendSpamHere.ORG wrote:
> In article <l7hjc2$759$1 at news.albasani.net>, Jan-Erik Soderholm <jan-erik.soderholm at telia.com> writes:
>>Stephen Hoffman wrote 2013-12-02 03:50:
>>> On 2013-12-02 02:00:33 +0000, VAXman- @SendSpamHere.ORG said:
>>>
>>>> Well, this <https://github.com/dilshod/xlsx2csv/blob/master/xlsx2csv.py>
>>>> in Python turned out to be less than 40 lines in Perl, replete with being
>>>> able to parse *BOTH* .XLS and .XLSX into .CSV!!!
>>>
>>> FWIW: <http://stackoverflow.com/questions/9884353/xls-to-csv-convertor>
>>>
>>>
>>
>>The 10 line example on Hoffs link runs out-of-the-box with the Python
>>port for OpenVMS. Both the xlrd and the csv modules are pre-built into
>>the port. Just a downdload of two files from http://www.vmspython.org/
>>and a few LD and MOUNT commands to mount the two container files.
>>
>>The current xlrd in the port (0.9.1, not 0.7.1 as the web page says)
>>supports .xlsx (from 0.8.0 according to Hoffs link above).
>>
>>But to actualy compare, the source for the 40 line Perl script would
>>be nice to have. This is the Python code b.t.w (from Hoffs link):
>>
>>----------------------------------------------------------
>> import xlrd
>> import csv
>>
>> def csv_from_excel():
>>
>> wb = xlrd.open_workbook('your_workbook.xls')
>> sh = wb.sheet_by_name('Sheet1')
>> your_csv_file = open('your_csv_file.csv', 'wb')
>> wr = csv.writer(your_csv_file, quoting=csv.QUOTE_ALL)
>>
>> for rownum in xrange(sh.nrows):
>> wr.writerow(sh.row_values(rownum))
>>
>> your_csv_file.close()
>>----------------------------------------------------------
>
> Quote all? I'll assume that means that all of the CSVs are quoted?
>
> What about monetary values? This particular customer is taking in
> data from international customers with different currency cirteria.
I don't understand your question. To me, QUOTE_ALL means that numeric
fields can contain commas without causing havoc when the subsequent CSV
reader processes the file.
--
Paul Sture
More information about the Info-vax
mailing list