TheStig has asked for the wisdom of the Perl Monks concerning the following question:
Hello all, I come seeking knowledge for my problem. I am trying to parse data from a .xlsx file and get it into a .csv file. This is normally not a problem, but in this file I am getting they have put a header on it that only will appear in Excel when you print the spreadsheet. It is not a normal header that I can just go in and show. Of course they have put data in this header that we need. The following is my code that I am using to see that I am currently parsing what I need from the excel file. I know it is inefficient, but I just started writing any perl a couple days ago.
#!/usr/bin/perl -w use warnings; use strict; use Spreadsheet::XLSX; use Date::Format; my $fileName = "file path GOES HERE"; my $workbook = Spreadsheet::XLSX->new($fileName) or die "Unable to rea +d the Excel file: $@$!"; for my $worksheet($workbook->worksheet("AMD 87 MAY 14")){ my($firstRow, $lastRow) = $worksheet->row_range(); my($firstCol, $lastCol) = $worksheet->col_range(); for my $row($firstRow .. $lastRow){ for my $col($firstCol .. $lastCol){ my $cell = $worksheet->get_cell($row, $col); next unless $cell; print "Row, Col = ($row, $col)\n"; print "Value = ", $cell->value(). "\n"; } } }
I am unsure if it is even possible to parse that print only header in the file, but I was guessing if anyone knew if it could happen it would be you guys.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Print Only header Excel
by Tux (Canon) on May 31, 2014 at 08:19 UTC | |
|
Re: Print Only header Excel
by Corion (Patriarch) on May 30, 2014 at 21:01 UTC | |
|
Re: Print Only header Excel
by GotToBTru (Prior) on May 30, 2014 at 20:01 UTC | |
|
Re: Print Only header Excel
by InfiniteSilence (Curate) on May 30, 2014 at 20:59 UTC | |
|
Re: Print Only header Excel
by TheStig (Novice) on Jun 02, 2014 at 15:17 UTC | |
by poj (Abbot) on Jun 02, 2014 at 15:33 UTC |