[Info-vax] PERL for OpenVMS Alpha that will install on V8.4
VAXman- at SendSpamHere.ORG
VAXman- at SendSpamHere.ORG
Tue Dec 3 08:47:52 EST 2013
In article <l7jqcn$ifc$2 at dont-email.me>, David Froble <davef at tsoft-inc.com> writes:
>VAXman- @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.
>>
>
>As usual, one size really doesn't fit all ....
Right. Shoes, briefs, bras, and client's applications are not a one size
fits all scenario.
I looked at a number of "lingos" for implementation. The most important
part being a way to obtain the Excel data to produce the CSV files with a
format which the client was already processing, and which looked similar
to the CSV output produced when exported from Excel. This information is
coming in from around the globe, so there are differences in dates, money
representation, value millmarks, etc. Perl's Spreadsheet class afforded
me a way to easily get the Excel cell's value and associated format so I
could convert this data into a CSV format that the client could already
digest. I would have perferred to write this in a HLL (like Macro ;) )
but I have no desire to decode the devil's tongue incantations sprawled
within the .XLS and .XLSX files. Somebody else already sold their soul
to Beelze$oft and provided that devil's tongue translation for me.
This was all for the "convenience" of their clients/customers which, I'll
admit, I'm still amiss as to how exporting a spreadsheet is inconvenient.
--
VAXman- A Bored Certified VMS Kernel Mode Hacker VAXman(at)TMESIS(dot)ORG
Well I speak to machines with the voice of humanity.
More information about the Info-vax
mailing list