in reply to HTML entity write error

Nar:

If you want a .CSV file, then using Excel is a pretty terrible way to get there. I've had innumerable problems where people think that Excel is a nice data transport medium. It has a terrible habit of changing your data for you. Instead, use something like Text::CSV.

Even if--after Herculean efforts--you get your file created properly, anyone opening the spreadsheet to look at it could munge it all up as Excel converts the data when it displays. Unless they close without saving, it can break your file.

I shudder at remembering the six month period where the testers *insisted* on using Excel for a data matching job....

/me off to the medicine cabinet to get a few Tylenol. I probably ought to wash it down with a fifth of bourbon.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^2: HTML entity write error
by tobyink (Canon) on Aug 23, 2013 at 05:50 UTC

    What's Excel got to do with it? The OP didn't mention Excel at all.

    Update: 2teez is also apparently talking about Excel. Perhaps the question has been altered at some stage, but the current question doesn't ask about Excel, and the code given doesn't generate an Excel spreadsheet.

    use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name"

      tobyink:

      I saw Spreadsheet::Write and my mind immediately went to "Eh? Using a spreadsheet to create a CSV file?" and then the (truly horrible) memories surfaced. So while composing the note, I was thinking that Excel was used. My original point of using a module specifically for the task was on point, while my knee-jerk reaction to using a spreadsheet as a data transport medium was simply an added bonus. ;^)

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.

        Spreadsheet::Write actually uses Text::CSV to output CSV files anyway. Spreadsheet::Write just provides a slightly nicer interface, and more importantly allows you to use the same interface for writing either CSV or Excel files.

        FWIW, the reason I'm quite familiar with Spreadsheet::Write is because I forked it to create Spreadsheet::Wright which is a drop-in replacement that also supports OpenOffice, HTML, XHTML and JSON output (and has saner internals).

        use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name"
      Did you miss use Spreadsheet::Write; in the code at Ln4?

      Oops. Apologies.
      reminder to self: read on down thru the thread (branch) before replying.!