Solved

Worksheet name too large?

Posted on 2014-01-03
2
307 Views
Last Modified: 2014-01-03
I am new to perl and I am running a code to read in .xls files and combine them into a text file. The data was in Pdf, but I have converted then to .xls files using a pdf converter. Unfortunately it tries to put the worksheet name from the filename, so in an example the filename is VendorPS000102_INV1451879_PS000102inv0000066067_001451879s_20120709.xls and the worksheet name is VendorPS000102_INV1451879_PS000. The error I get is

"use of initialised value $iPTN2 in bitwise and (&)( at C:/perl/site/lib/spreadsheet/ParseExcel.pm line 1521"

If I change the worksheet name to Fred, it works fine. The program is:-


while ((length(@flist[$count]) > 0))
      { $filename =@flist[$count];
            if (substr($filename,length($filename)-4,3) eq "xls" )  
            {
      $filename =  substr(@flist[$count],0,length(@flist[$count])-1) ;
 
    my $parser   = Spreadsheet::ParseExcel->new();
    my $workbook = $parser->parse($filename);

    die $parser->error(), ".\n" if ( !defined $workbook );

    # Following block is used to Iterate through all worksheets
    # in the workbook and print the worksheet content
    #for my $worksheet ( $workbook->worksheets(1) ) {
             foreach my $sheet (0 .. $sheet  - 1) {

        # Find out the worksheet ranges
        my ( $row_min, $row_max ) = $sheet->row_range();
        my ( $col_min, $col_max ) = $sheet->col_range();

        for my $row ( $row_min .. $row_max ) {
            @line =($row,"|",$filename, "|",$sheet->{Name},"|");
            for my $col ( $col_min .. $col_max ) {

                # Return the cell object at $row and $col
                my $cell = $sheet->get_cell( $row, $col );
                 if ($cell) {
            
       push (@line , "|",$cell->unformatted());
      }
        else
           {
        push (@line , "|");
           }
                  }
                  print GH @line ,"\n";
                        }
                  }
            } $count++;
      }

I would be grateful of any help.

Cheers

Alastair
0
Comment
Question by:alastairwg1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
ButlerTechnology earned 500 total points
ID: 39753563
The maximum length of a worksheet name is 30 characters
0
 

Author Closing Comment

by:alastairwg1
ID: 39753682
thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question