Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Worksheet name too large?

Posted on 2014-01-03
2
Medium Priority
?
312 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 1500 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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

688 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