Thread: [R-gregmisc-users] SF.net SVN: r-gregmisc:[1380] trunk/gdata/inst/perl/xls2csv.pl
Brought to you by:
warnes
|
From: <wa...@us...> - 2010-01-23 05:17:26
|
Revision: 1380
http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1380&view=rev
Author: warnes
Date: 2010-01-23 05:17:20 +0000 (Sat, 23 Jan 2010)
Log Message:
-----------
If only one sheet is present in the file, don't insert the sheet name into the filename
Modified Paths:
--------------
trunk/gdata/inst/perl/xls2csv.pl
Modified: trunk/gdata/inst/perl/xls2csv.pl
===================================================================
--- trunk/gdata/inst/perl/xls2csv.pl 2010-01-23 04:38:31 UTC (rev 1379)
+++ trunk/gdata/inst/perl/xls2csv.pl 2010-01-23 05:17:20 UTC (rev 1380)
@@ -158,7 +158,7 @@
$sheetname = $sheet->{Name};
- if( defined($sheetnumber) || defined($targetsheetname) )
+ if( defined($sheetnumber) || defined($targetsheetname) || $oBook->{SheetCount}==1 )
{
if( defined($targetfile) )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wa...@us...> - 2010-01-23 07:11:55
|
Revision: 1387
http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1387&view=rev
Author: warnes
Date: 2010-01-23 07:11:46 +0000 (Sat, 23 Jan 2010)
Log Message:
-----------
Check if parsing the xls file succeeds... Current code doesn't handle new XML-based format
Modified Paths:
--------------
trunk/gdata/inst/perl/xls2csv.pl
Modified: trunk/gdata/inst/perl/xls2csv.pl
===================================================================
--- trunk/gdata/inst/perl/xls2csv.pl 2010-01-23 07:09:08 UTC (rev 1386)
+++ trunk/gdata/inst/perl/xls2csv.pl 2010-01-23 07:11:46 UTC (rev 1387)
@@ -117,7 +117,7 @@
close(FH);
print "Loading '$ARGV[0]'...\n";
-my $oBook = $oExcel->Parse($ARGV[0]);
+my $oBook = $oExcel->Parse($ARGV[0]) or die "Error parsing file '$ARGV[0]'.\n";
print "Done.\n";
print "\n";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wa...@us...> - 2012-08-13 22:13:47
|
Revision: 1594
http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1594&view=rev
Author: warnes
Date: 2012-08-13 22:13:40 +0000 (Mon, 13 Aug 2012)
Log Message:
-----------
Remove trailing space from output line.
Modified Paths:
--------------
trunk/gdata/inst/perl/xls2csv.pl
Modified: trunk/gdata/inst/perl/xls2csv.pl
===================================================================
--- trunk/gdata/inst/perl/xls2csv.pl 2012-06-29 19:03:27 UTC (rev 1593)
+++ trunk/gdata/inst/perl/xls2csv.pl 2012-08-13 22:13:40 UTC (rev 1594)
@@ -267,7 +267,7 @@
}
else
{
- print OutFile "$outputLine \n"
+ print OutFile "$outputLine\n"
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wa...@us...> - 2014-08-28 04:55:18
|
Revision: 1879
http://sourceforge.net/p/r-gregmisc/code/1879
Author: warnes
Date: 2014-08-28 04:55:11 +0000 (Thu, 28 Aug 2014)
Log Message:
-----------
Handle Excel files created on the Mac, where by default Excel uses
1904-01-01 as the baseline for dates, rather than the usual 1900-01-01.
Modified Paths:
--------------
trunk/gdata/inst/perl/xls2csv.pl
Modified: trunk/gdata/inst/perl/xls2csv.pl
===================================================================
--- trunk/gdata/inst/perl/xls2csv.pl 2014-08-28 03:08:23 UTC (rev 1878)
+++ trunk/gdata/inst/perl/xls2csv.pl 2014-08-28 04:55:11 UTC (rev 1879)
@@ -20,7 +20,7 @@
my(
$HAS_Spreadsheet_ParseExcel,
$HAS_Compress_Raw_Zlib,
- $HAS_Spreadsheet_XLSX
+ $HAS_Spreadsheet_ParseXLSX
) = check_modules_and_notify();
# declare some varibles local
@@ -29,7 +29,7 @@
$filename, $volume, $directories, $whoami,
$sep, $sepName, $sepLabel, $sepExt,
$skipBlankLines, %switches,
- $parser, $oBook
+ $parser, $oBook, $formatter
);
##
@@ -135,7 +135,8 @@
my $oExcel;
my $oBook;
-$oExcel = new Spreadsheet::ParseExcel;
+$oExcel = new Spreadsheet::ParseExcel;
+$formatter = Spreadsheet::ParseExcel::FmtDefault->new();
open(FH, "<$ARGV[0]") or die "Unable to open file '$ARGV[0]'.\n";
close(FH);
@@ -240,14 +241,27 @@
for(my $col = $mincol; $col <= $maxcol; $col++)
{
- my $cell = $sheet->{Cells}[$row][$col];
+ my $cell = $sheet->{Cells}[$row][$col];
+ my $format = $formatter->FmtString($cell, $oBook);
if( defined($cell) )
{
- $_=$cell->Value; #{Val};
+ if ($cell->type() eq "Date" && $oBook->{Flag1904} )
+ {
+ $_ = ExcelFmt($format,
+ $cell->unformatted(),
+ $oBook->{Flag1904});
+ }
+ else
+ {
+ $_=$cell->value();
+ }
# convert '#NUM!' strings to missing (empty) values
s/#NUM!//;
+ # convert "#DIV/0!" strings to missing (emtpy) values
+ s|#DIV/0!||;
+
# escape double-quote characters in the data since
# they are used as field delimiters
s/\"/\\\"/g;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wa...@us...> - 2015-04-14 20:52:29
|
Revision: 1925
http://sourceforge.net/p/r-gregmisc/code/1925
Author: warnes
Date: 2015-04-14 20:52:26 +0000 (Tue, 14 Apr 2015)
Log Message:
-----------
Replace depricated PERL function POSIX::isnumeric with equivalent regexp
Modified Paths:
--------------
trunk/gdata/inst/perl/xls2csv.pl
Modified: trunk/gdata/inst/perl/xls2csv.pl
===================================================================
--- trunk/gdata/inst/perl/xls2csv.pl 2015-04-14 19:43:15 UTC (rev 1924)
+++ trunk/gdata/inst/perl/xls2csv.pl 2015-04-14 20:52:26 UTC (rev 1925)
@@ -118,7 +118,7 @@
if(defined($ARGV[2]) )
{
- if ( isdigit($ARGV[2]) )
+ if ( $ARGV[2] =~ m|^\d+$| )
{
$sheetnumber = $ARGV[2];
die "Sheetnumber must be an integer larger than 0.\n" if $sheetnumber < 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wa...@us...> - 2015-04-23 21:55:49
|
Revision: 1951
http://sourceforge.net/p/r-gregmisc/code/1951
Author: warnes
Date: 2015-04-23 21:55:42 +0000 (Thu, 23 Apr 2015)
Log Message:
-----------
Remove 'use POSIX' from xls2csv.pl since it is no longer needed
Modified Paths:
--------------
trunk/gdata/inst/perl/xls2csv.pl
Modified: trunk/gdata/inst/perl/xls2csv.pl
===================================================================
--- trunk/gdata/inst/perl/xls2csv.pl 2015-04-23 21:53:19 UTC (rev 1950)
+++ trunk/gdata/inst/perl/xls2csv.pl 2015-04-23 21:55:42 UTC (rev 1951)
@@ -9,7 +9,6 @@
use strict;
#use Spreadsheet::ParseExcel;
#use Spreadsheet::ParseXLSX;
-use POSIX;
use File::Spec::Functions;
use Getopt::Std;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wa...@us...> - 2015-04-25 08:49:48
|
Revision: 1964
http://sourceforge.net/p/r-gregmisc/code/1964
Author: warnes
Date: 2015-04-25 08:49:41 +0000 (Sat, 25 Apr 2015)
Log Message:
-----------
Error message about executable name was missing one alternative
Modified Paths:
--------------
trunk/gdata/inst/perl/xls2csv.pl
Modified: trunk/gdata/inst/perl/xls2csv.pl
===================================================================
--- trunk/gdata/inst/perl/xls2csv.pl 2015-04-25 07:59:03 UTC (rev 1963)
+++ trunk/gdata/inst/perl/xls2csv.pl 2015-04-25 08:49:41 UTC (rev 1964)
@@ -1,9 +1,9 @@
#!/usr/bin/perl
BEGIN {
-use File::Basename;
-# Add current path to perl library search path
-use lib dirname($0);
+ use File::Basename;
+ # Add current path to perl library search path
+ use lib dirname($0);
}
use strict;
@@ -61,7 +61,7 @@
}
else
{
- die("This script is named '$whoami', but must be named either 'xls2csv.pl' or 'xls2tab.pl' to function properly.\n");
+ die("This script is named '$whoami', but must be named 'xls2csv.pl', 'xls2tsv', or 'xls2tab.pl' to function properly.\n");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|