Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

old style xls module

by expo1967 (Novice)
on Aug 04, 2018 at 22:54 UTC ( #1219859=perlquestion: print w/replies, xml ) Need Help??
expo1967 has asked for the wisdom of the Perl Monks concerning the following question:

I need a module that generates an "older style" XLS format excel spreadsheet file to be used in a CGI script. I have had issues working with XLSX format files in CGI scripts.

Replies are listed 'Best First'.
Re: old style xls module
by roboticus (Chancellor) on Aug 04, 2018 at 23:29 UTC
Re: old style xls module
by Anonymous Monk on Aug 04, 2018 at 23:30 UTC
Re: old style xls module
by talexb (Canon) on Aug 07, 2018 at 03:16 UTC

    You could also just generate a CSV file. That works fine in lots of versions of Excel. :)

    Alex / talexb / Toronto

    Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

      Yes and no. CSV is very portable, but, certainly on web-pages, subject to locale-trouble. As the separator (esp on Windows) is depending on the locale setting, it might do strange things on other poeple's machines.

      As XLS, the old style Excel, is very well documented, it is much safer to generate your data as CSV and convert it to Excel (.xls) yourself and use that for the CGI.


      Enjoy, Have FUN! H.Merijn
      You could also just generate a CSV file. That works fine in lots of versions of Excel. :)

      And as an extra bonus, the users are not locked in to Excel, but could also use other spreadsheet applications. On the other hand, most of them can read Excel files, more or less.

      One quite obvious difference between XLS(X) and CSV is that you can not add any formatting to CSV. You simply can not make one row bold or a column green, or a cell contain a big fat warning. For that, you need one of the Excel formats, or generate HTML and perhaps a style sheet. Of course, importing HTML into Excel is a completely different problem.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

        Other advantages of XLS/XLSX/ODS over CSV:

        • Multiple sheets
        • Multiple encodings (CSV has no official support for encodings at all, unless you use a BOM which breaks many parsers)
        • Comments and notes
        • Hiding columns and/or rows
        • Happy managers

        Enjoy, Have FUN! H.Merijn

      You could also just generate a CSV file. That works fine in lots of versions of Excel. :)

      There are a lot of problems i used to face when creating CSV/TDF files for Excel. I first encountered this problem dealing with leading zeros and stock numbers that looked like 1E123. Below find a csv file that documents some of them.

      ="--------------------" ="leading equals fixes these" "something excell may think as a date" ,="2012-12-12" ,"2012-12-12" ,="2/4" ,"2/4" "something excell may think is a number" ,="1e123" ,"1e123" "leading zeros" ,="00001" ,"00001" "leading equals" ,="=x" ,"=x" "there are more that ive forgotten" ="--------------------" ="leading equals busts these" "commas in string" ,"created,2016-06-19-03-02-26" ,="created,2016-06-19-03-02-26" "long strings" ,"|001-----0|010-----0|020-----0|030-----0|040-----0|050-----0|060---- +-0|070-----0|080-----0|090-----0|101-----0|110-----0|120-----0|130--- +--0|140-----0|150-----0|160-----0|170-----0|180-----0|190-----0|201-- +---0|210-----0|220-----0|230-----0|240-----0|250-----0|260-----0|270- +----0|280-----0|290-----0" ,="|001-----0|010-----0|020-----0|030-----0|040-----0|050-----0|060--- +--0|070-----0|080-----0|090-----0|101-----0|110-----0|120-----0|130-- +---0|140-----0|150-----0|160-----0|170-----0|180-----0|190-----0|201- +----0|210-----0|220-----0|230-----0|240-----0|250-----0|260-----0|270 +-----0|280-----0|290-----0" "so everthing is output as =""..."" that does not have a comma or is l +ong" "you can still perform arithmatic on a =""..."" when it is a number"
      As you can see i used what i called the "literal function" (="...") to deal with many of them.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1219859]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2018-08-15 11:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (160 votes). Check out past polls.

    Notices?