# read from a file and extract the contents into an Excel file sub write_to_Excel() { use Spreadsheet::WriteExcel; my @columnNames; my @rowValues; my $count = 0; my $row = 0; my $fileArray = "F:/User_Interface/dbStuff/ArrayExpress.txt"; open( INFILE, "<$fileArray") or die "Cannot open the file"; print("Searching File..."); foreach $line ( ) { if( $line =~ /^Name/ ) { @columnNames = split(/\t/, $line); } else { @rowValues = split(/\t/, $line); } } # Create a new workbook and save a file called example.xls # and add a worksheet called Summary to that. my $workbook = Spreadsheet::WriteExcel->new("ArrayExpress.xls"); my $worksheet = $workbook->add_worksheet(`Summary`); # Set text bold, red, underlined for values # designated as high # my $high_val = $workbook->add_format(); # $high_val->set_bold(); # $high_val->set_color(`red`); # $high_val->set_underline(); ###### not sure how to loop through array to put rows across then down and same with cols $worksheet->write($row,$count,$element); foreach $element(@columnNames) { $count++; $worksheet->write($row,$count,$element); } foreach my $element(@rowValues) { $worksheet->write($row,$count,$element); $count++; $row++; } }