Extracting Excel to text on Linux server -
i’ve been struggling converting *.xls files generated instrument text format on linux server. i’m unable process files spreadsheet::parseexcel, unless, manually open them, sign off on security warning , save them. otherwise, not recognized excel (tested sample code).
!/usr/bin/perl -w use strict; use spreadsheet::parseexcel; $parser = spreadsheet::parseexcel->new(); $file = "/data/excel/matrix.xls"; $workbook = $parser->parse($file); if ( !defined $workbook ) { print "can't find workbook!!!"; die $parser->error(), ".\n"; } $worksheet ( $workbook->worksheets() ) { ( $row_min, $row_max ) = $worksheet->row_range(); ( $col_min, $col_max ) = $worksheet->col_range(); $row ( $row_min .. $row_max ) { $col ( $col_min .. $col_max ) { $cell = $worksheet->get_cell( $row, $col ); next unless $cell; print "row, col = ($row, $col)\n"; print "value = ", $cell->value(), "\n"; print "unformatted = ", $cell->unformatted(), "\n"; print "\n"; } } }
i’ve tried changing extension *.prn , lets me open files manually without warning not recognized spreadsheet::parseexcel either.
the files contain 8 columns of data on first sheet only. convert them text files , used them values in perl script. here sample data in excel:
gene target barcode1 barcode2 barcode3 barcode4 barcode5 barcode6 motor motor_1 343 453 432 345 543 342 mycn mycn_2 342 98 87 876 54 765
my last option use vba reader stick perl/shell code if possible. there straightforward solution problem?
thank you,
it's not particularly elegant, might try using linux command "strings" extract printable characters spreadsheet file first. parse output until see column headings, , data should after that.
Comments
Post a Comment