CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Not a GLOB reference at in Filehandle

 



rammohan
Novice

Feb 16, 2014, 11:42 PM

Post #1 of 5 (865 views)
Not a GLOB reference at in Filehandle Can't Post


Code
#!/usr/bin/perl -w 
use strict;
use warnings;
use IO::Handle;
use FileHandle;
use Spreadsheet::ParseExcel;
my $xlsparser = Spreadsheet::ParseExcel->new();
my $xlsbook = $xlsparser->parse('/home/Admin/Downloads/Refined RP Processed data.xls');
my $xls = $xlsbook->worksheet(0);
my ( $row_first, $row_last ) = $xls->row_range();
my ( $col_first, $col_last ) = $xls->col_range();
my $csv = '';
for my $row ( $row_first .. $row_last ) {
for my $col ( $col_first .. $col_last ) {
my $cell = $xls->get_cell( $row, $col );
next unless $cell;
$csv .= $cell->unformatted();
if ($col == $col_last) {
$csv .= "\n";
} else {
$csv .= ",";
}
}
}
open(my $FH ,'>',"/home/Admin/Downloads/ram.csv") or die "oops!";
while (my $line = <$xlsbook>){
print $FH $line;
}


While Running above script I'm getting error like

Code
Not a GLOB reference at csv.pl line 26

. Please suggest me where I'm going wrong please suggest me


Laurent_R
Veteran / Moderator

Feb 17, 2014, 2:25 AM

Post #2 of 5 (860 views)
Re: [rammohan] Not a GLOB reference at in Filehandle [In reply to] Can't Post

You opened $xlsbook as a spreadsheet object, not as a hand on a plain file. You can't use it as a file handle with the <$xlsbook> syntax. The error tells you that $xlsbook if nos a file handle.


rammohan
Novice

Feb 17, 2014, 2:33 AM

Post #3 of 5 (857 views)
Re: [Laurent_R] Not a GLOB reference at in Filehandle [In reply to] Can't Post

Please tell me how to resolve this error


FishMonger
Veteran / Moderator

Feb 17, 2014, 8:42 AM

Post #4 of 5 (839 views)
Re: [rammohan] Not a GLOB reference at in Filehandle [In reply to] Can't Post

xls2csv - A script that recodes a spreadsheet's charset and saves as CSV.
http://search.cpan.org/~ken/xls2csv-1.07/script/xls2csv


rammohan
Novice

Feb 17, 2014, 10:19 PM

Post #5 of 5 (817 views)
Re: [FishMonger] Not a GLOB reference at in Filehandle [In reply to] Can't Post

I tried that link but its not help for me... please tell me how to resolve this error.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives