public function toSheet($array, $sheet_name, $ext=false)
  {
    if(!$ext){
      $ext=pathinfo($sheet_name, PATHINFO_EXTENSION);  
    }
    switch ($ext) {
      case 'csv':
      $writer = WriterFactory::create(Type::CSV);
      break;
      case 'ods':
      $writer = WriterFactory::create(Type::ODS);
      break;
      case 'xlsx':
      $writer = WriterFactory::create(Type::XLSX);
      break;
    }
    @$writer->openToFile($sheet_name);
    foreach ($array as $row) {
      $writer->addRow($row);
    }
    if (is_null($writer->close())) {
      return true;
    } else {
      return false;
    }
  }