ok
I used this code to try to get the columns 2,3,4,5.

        my @indexes = (2 .. (2+4-1));
                                my @dcells = @{$sheet->{Cells}[$row]}[@indexes];
                                
                                foreach (@dcells) {
                                print $_;
                                }

but when I try to print the cell values to the screen so I can see that its 
giving me what I need. it prints this stuff:
Spreadsheet::ParseExcel::Cell=HASH(0x70be710)Spreadsheet::ParseExcel::Cell=HASH(0x70be758)Spreadsheet::ParseExcel::Cell=HASH(0x70be710)Spreadsheet::ParseExcel::Cell=HASH(0x70be758)

how do I access the actual data in the cell as opposed to this stuff?

Thanks
 Ken


On Thursday, May 24, 2012 8:41:36 AM UTC-7, Ken Furff wrote:
> I am using the spreadsheet::xlsx module in a script im writing. I need to 
> extract about 4 columns out of about 60. I need those specific columns for 
> comparison and updating. I assume that I'll load the data into an array or an 
> array of arrays for comparison. I am able to extract the contents of the 
> file, but I cant figure out how to specify just those columns... I'll put the 
> code i currently have below
> 
> use Spreadsheet::XLSX;
> 
> $excel = Spreadsheet::XLSX -> new ('build.xlsx');
> foreach my $sheet (@{$excel -> {Worksheet}}) {
> 
> printf("Sheet: %s\n", $sheet->{Name});
> $sheet -> {MaxRow} ||=$sheet -> {MinRow};
>       
> foreach $row ($sheet -> {MinRow} .. $sheet -> {MaxRow})  {
>               
> $sheet -> {MaxCol} ||= $sheet -> {MinCol};
>                       
> foreach $col ($sheet -> {MinCol} .. $sheet -> {MaxCol})  {
>                       
> $cell = $sheet -> {Cells} [$row] [$col];
>                       
> if ($cell) {
> open FILE, ">>buildop.txt" or die $!;
> printf FILE ("(%s , %s) => %s\n", $row, $col, $cell -> {Val});
> close FILE;
> }
> }
> }
> }
> 
> this just prints the results to a file so I could examine it and try to 
> figure out how to get just those columns
> help



On Thursday, May 24, 2012 8:41:36 AM UTC-7, Ken Furff wrote:
> I am using the spreadsheet::xlsx module in a script im writing. I need to 
> extract about 4 columns out of about 60. I need those specific columns for 
> comparison and updating. I assume that I'll load the data into an array or an 
> array of arrays for comparison. I am able to extract the contents of the 
> file, but I cant figure out how to specify just those columns... I'll put the 
> code i currently have below
> 
> use Spreadsheet::XLSX;
> 
> $excel = Spreadsheet::XLSX -> new ('build.xlsx');
> foreach my $sheet (@{$excel -> {Worksheet}}) {
> 
> printf("Sheet: %s\n", $sheet->{Name});
> $sheet -> {MaxRow} ||=$sheet -> {MinRow};
>       
> foreach $row ($sheet -> {MinRow} .. $sheet -> {MaxRow})  {
>               
> $sheet -> {MaxCol} ||= $sheet -> {MinCol};
>                       
> foreach $col ($sheet -> {MinCol} .. $sheet -> {MaxCol})  {
>                       
> $cell = $sheet -> {Cells} [$row] [$col];
>                       
> if ($cell) {
> open FILE, ">>buildop.txt" or die $!;
> printf FILE ("(%s , %s) => %s\n", $row, $col, $cell -> {Val});
> close FILE;
> }
> }
> }
> }
> 
> this just prints the results to a file so I could examine it and try to 
> figure out how to get just those columns
> help



On Thursday, May 24, 2012 8:41:36 AM UTC-7, Ken Furff wrote:
> I am using the spreadsheet::xlsx module in a script im writing. I need to 
> extract about 4 columns out of about 60. I need those specific columns for 
> comparison and updating. I assume that I'll load the data into an array or an 
> array of arrays for comparison. I am able to extract the contents of the 
> file, but I cant figure out how to specify just those columns... I'll put the 
> code i currently have below
> 
> use Spreadsheet::XLSX;
> 
> $excel = Spreadsheet::XLSX -> new ('build.xlsx');
> foreach my $sheet (@{$excel -> {Worksheet}}) {
> 
> printf("Sheet: %s\n", $sheet->{Name});
> $sheet -> {MaxRow} ||=$sheet -> {MinRow};
>       
> foreach $row ($sheet -> {MinRow} .. $sheet -> {MaxRow})  {
>               
> $sheet -> {MaxCol} ||= $sheet -> {MinCol};
>                       
> foreach $col ($sheet -> {MinCol} .. $sheet -> {MaxCol})  {
>                       
> $cell = $sheet -> {Cells} [$row] [$col];
>                       
> if ($cell) {
> open FILE, ">>buildop.txt" or die $!;
> printf FILE ("(%s , %s) => %s\n", $row, $col, $cell -> {Val});
> close FILE;
> }
> }
> }
> }
> 
> this just prints the results to a file so I could examine it and try to 
> figure out how to get just those columns
> help



On Thursday, May 24, 2012 8:41:36 AM UTC-7, Ken Furff wrote:
> I am using the spreadsheet::xlsx module in a script im writing. I need to 
> extract about 4 columns out of about 60. I need those specific columns for 
> comparison and updating. I assume that I'll load the data into an array or an 
> array of arrays for comparison. I am able to extract the contents of the 
> file, but I cant figure out how to specify just those columns... I'll put the 
> code i currently have below
> 
> use Spreadsheet::XLSX;
> 
> $excel = Spreadsheet::XLSX -> new ('build.xlsx');
> foreach my $sheet (@{$excel -> {Worksheet}}) {
> 
> printf("Sheet: %s\n", $sheet->{Name});
> $sheet -> {MaxRow} ||=$sheet -> {MinRow};
>       
> foreach $row ($sheet -> {MinRow} .. $sheet -> {MaxRow})  {
>               
> $sheet -> {MaxCol} ||= $sheet -> {MinCol};
>                       
> foreach $col ($sheet -> {MinCol} .. $sheet -> {MaxCol})  {
>                       
> $cell = $sheet -> {Cells} [$row] [$col];
>                       
> if ($cell) {
> open FILE, ">>buildop.txt" or die $!;
> printf FILE ("(%s , %s) => %s\n", $row, $col, $cell -> {Val});
> close FILE;
> }
> }
> }
> }
> 
> this just prints the results to a file so I could examine it and try to 
> figure out how to get just those columns
> help


On Thursday, May 24, 2012 8:41:36 AM UTC-7, Ken Furff wrote:
> I am using the spreadsheet::xlsx module in a script im writing. I need to 
> extract about 4 columns out of about 60. I need those specific columns for 
> comparison and updating. I assume that I'll load the data into an array or an 
> array of arrays for comparison. I am able to extract the contents of the 
> file, but I cant figure out how to specify just those columns... I'll put the 
> code i currently have below
> 
> use Spreadsheet::XLSX;
> 
> $excel = Spreadsheet::XLSX -> new ('build.xlsx');
> foreach my $sheet (@{$excel -> {Worksheet}}) {
> 
> printf("Sheet: %s\n", $sheet->{Name});
> $sheet -> {MaxRow} ||=$sheet -> {MinRow};
>       
> foreach $row ($sheet -> {MinRow} .. $sheet -> {MaxRow})  {
>               
> $sheet -> {MaxCol} ||= $sheet -> {MinCol};
>                       
> foreach $col ($sheet -> {MinCol} .. $sheet -> {MaxCol})  {
>                       
> $cell = $sheet -> {Cells} [$row] [$col];
>                       
> if ($cell) {
> open FILE, ">>buildop.txt" or die $!;
> printf FILE ("(%s , %s) => %s\n", $row, $col, $cell -> {Val});
> close FILE;
> }
> }
> }
> }
> 
> this just prints the results to a file so I could examine it and try to 
> figure out how to get just those columns
> help



On Thursday, May 24, 2012 8:41:36 AM UTC-7, Ken Furff wrote:
> I am using the spreadsheet::xlsx module in a script im writing. I need to 
> extract about 4 columns out of about 60. I need those specific columns for 
> comparison and updating. I assume that I'll load the data into an array or an 
> array of arrays for comparison. I am able to extract the contents of the 
> file, but I cant figure out how to specify just those columns... I'll put the 
> code i currently have below
> 
> use Spreadsheet::XLSX;
> 
> $excel = Spreadsheet::XLSX -> new ('build.xlsx');
> foreach my $sheet (@{$excel -> {Worksheet}}) {
> 
> printf("Sheet: %s\n", $sheet->{Name});
> $sheet -> {MaxRow} ||=$sheet -> {MinRow};
>       
> foreach $row ($sheet -> {MinRow} .. $sheet -> {MaxRow})  {
>               
> $sheet -> {MaxCol} ||= $sheet -> {MinCol};
>                       
> foreach $col ($sheet -> {MinCol} .. $sheet -> {MaxCol})  {
>                       
> $cell = $sheet -> {Cells} [$row] [$col];
>                       
> if ($cell) {
> open FILE, ">>buildop.txt" or die $!;
> printf FILE ("(%s , %s) => %s\n", $row, $col, $cell -> {Val});
> close FILE;
> }
> }
> }
> }
> 
> this just prints the results to a file so I could examine it and try to 
> figure out how to get just those columns
> help


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to