smith
smith

Reputation: 3282

creating csv file with perl

I created csv file with this perl module Text::CSV_XS on windows:

Below a snippet of my code :

use Text::CSV_XS;

my @a =('ID','VALUE'); 


open my $OUTPUT,'>',"file.csv" or die "Can't able to open file.csv\n";

my $csv = Text::CSV_XS->new ({ binary => 1, eol => $/ });



$csv->print($OUTPUT,\@a);

this code generate a file.csv but when I try to open the file.csv with xls the xls write that this file is SYLK and can't know it could someone help why this csv can't open with xls?

Upvotes: 9

Views: 2855

Answers (1)

SAN
SAN

Reputation: 2247

This problem occurs when you open a text file or CSV file and the first two characters of the file are the uppercase letters "I" and "D"

"SYLK: File format is not valid" error message when you open file

Upvotes: 14

Related Questions