Changed from PHPExcel to some code by Sergey Schuchkin.