\PhpOffice\PhpSpreadsheetIOFactory

Factory to create readers and writers easily.

It is not required to use this class, but it should make it easier to read and write files. Especially for reading files with an unknown format.

Summary

Methods
Properties
Constants
createWriter()
createReader()
load()
identify()
createReaderForFile()
registerWriter()
registerReader()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
getReaderTypeFromExtension()
$readers
$writers
N/A

Properties

$readers

$readers : 

Type

$writers

$writers : 

Type

Methods

createWriter()

createWriter(\PhpOffice\PhpSpreadsheet\Spreadsheet  $spreadsheet, string  $writerType) : \PhpOffice\PhpSpreadsheet\Writer\IWriter

Create Writer\IWriter.

Parameters

\PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet
string $writerType

Example: Xlsx

Returns

\PhpOffice\PhpSpreadsheet\Writer\IWriter

createReader()

createReader(string  $readerType) : \PhpOffice\PhpSpreadsheet\Reader\IReader

Create Reader\IReader.

Parameters

string $readerType

Example: Xlsx

Returns

\PhpOffice\PhpSpreadsheet\Reader\IReader

load()

load(string  $pFilename) : \PhpOffice\PhpSpreadsheet\Spreadsheet

Loads Spreadsheet from file using automatic Reader\IReader resolution.

Parameters

string $pFilename

The name of the spreadsheet file

Returns

\PhpOffice\PhpSpreadsheet\Spreadsheet

identify()

identify(string  $pFilename) : string

Identify file type using automatic Reader\IReader resolution.

Parameters

string $pFilename

The name of the spreadsheet file to identify

Returns

string

createReaderForFile()

createReaderForFile(string  $filename) : \PhpOffice\PhpSpreadsheet\Reader\IReader

Create Reader\IReader for file using automatic Reader\IReader resolution.

Parameters

string $filename

The name of the spreadsheet file

Returns

\PhpOffice\PhpSpreadsheet\Reader\IReader

registerWriter()

registerWriter(string  $writerType, string  $writerClass) 

Register a writer with its type and class name.

Parameters

string $writerType
string $writerClass

registerReader()

registerReader(string  $readerType, string  $readerClass) 

Register a reader with its type and class name.

Parameters

string $readerType
string $readerClass

getReaderTypeFromExtension()

getReaderTypeFromExtension(string  $filename) : null|string

Guess a reader type from the file extension, if any.

Parameters

string $filename

Returns

null|string