code: public static function createReaderForFile($filename)
      {
          File::assertFile($filename);
  
          // First, lucky guess by inspecting file extension
          $guessedReader = self::getReaderTypeFromExtension($filename);
          if ($guessedReader !== null) {
              $reader = self::createReader($guessedReader);
  
              // Let's see if we are lucky
              if (isset($reader) && $reader->canRead($filename)) {
                  return $reader;
              }
          }
  
          // If we reach here then "lucky guess" didn't give any result
          // Try walking through all the options in self::$autoResolveClasses
          foreach (self::$readers as $type => $class) {
              //    Ignore our original guess, we know that won't work
              if ($type !== $guessedReader) {
                  $reader = self::createReader($type);
                  if ($reader->canRead($filename)) {
                      return $reader;
                  }
              }
          }
  
          throw new Reader\Exception('Unable to identify a reader for this file');
      }
docs: Create Reader\IReader for file using automatic Reader\IReader resolution.
  
  @param string $filename The name of the spreadsheet file
  
  @throws Reader\Exception
  
  @return Reader\IReader