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?
Reading and processing text files is one of the common tasks done by Perl. For example, often you encounter a CSV file (where CSV stand for Comma-separated values) and you need to extract some information from there.
open FILE, "<$ARGV[0]"; my @file = <FILE>; splice(@file, 0, 1); Done. Now your @file array doesn't have the first line anymore.
To read a column from csv for this purpose I wrote this script: #!/usr/bin/perl -w use strict; use warnings; use Text::CSV; my$column_separator = qr/,/; my $column_number = "3"; my$file = "/home/Admin/Documents/new (copy).
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With