BREAK_NONE
BREAK_NONE = 0
$invalidCharacters : array
Invalid characters in sheet title.
$parent : \PhpOffice\PhpSpreadsheet\Spreadsheet
Parent spreadsheet.
$cellCollection : \PhpOffice\PhpSpreadsheet\Collection\Cells
Collection of cells.
$rowDimensions : \PhpOffice\PhpSpreadsheet\Worksheet\RowDimension[]
Collection of row dimensions.
$defaultRowDimension : \PhpOffice\PhpSpreadsheet\Worksheet\RowDimension
Default row dimension.
$columnDimensions : \PhpOffice\PhpSpreadsheet\Worksheet\ColumnDimension[]
Collection of column dimensions.
$defaultColumnDimension : \PhpOffice\PhpSpreadsheet\Worksheet\ColumnDimension
Default column dimension.
$drawingCollection : \PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing[]
Collection of drawings.
$chartCollection : \PhpOffice\PhpSpreadsheet\Chart\Chart[]
Collection of Chart objects.
$title : string
Worksheet title.
$sheetState : string
Sheet state.
$pageSetup : \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup
Page setup.
$pageMargins : \PhpOffice\PhpSpreadsheet\Worksheet\PageMargins
Page margins.
$headerFooter : \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooter
Page header/footer.
$sheetView : \PhpOffice\PhpSpreadsheet\Worksheet\SheetView
Sheet view.
$protection : \PhpOffice\PhpSpreadsheet\Worksheet\Protection
Protection.
$styles : \PhpOffice\PhpSpreadsheet\Style\Style[]
Collection of styles.
$conditionalStylesCollection : array
Conditional styles. Indexed by cell coordinate, e.g. 'A1'.
$cellCollectionIsSorted : bool
Is the current cell collection sorted already?
$breaks : array
Collection of breaks.
$mergeCells : string[]
Collection of merged cell ranges.
$protectedCells : array
Collection of protected cell ranges.
$autoFilter : \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter
Autofilter Range and selection.
$freezePane : null|string
Freeze pane.
$topLeftCell : null|string
Default position of the right bottom pane.
$showGridlines : bool
Show gridlines?
$printGridlines : bool
Print gridlines?
$showRowColHeaders : bool
Show row and column headers?
$showSummaryBelow : bool
Show summary below? (Row/Column outline).
$showSummaryRight : bool
Show summary right? (Row/Column outline).
$comments : \PhpOffice\PhpSpreadsheet\Comment[]
Collection of comments.
$activeCell : string
Active cell. (Only one!).
$selectedCells : string
Selected cells.
$cachedHighestColumn : string
Cached highest column.
$cachedHighestRow : int
Cached highest row.
$rightToLeft : bool
Right-to-left?
$hyperlinkCollection : array
Hyperlinks. Indexed by cell coordinate, e.g. 'A1'.
$dataValidationCollection : array
Data validation objects. Indexed by cell coordinate, e.g. 'A1'.
$tabColor : \PhpOffice\PhpSpreadsheet\Style\Color
Tab color.
$dirty : bool
Dirty flag.
$hash : string
Hash.
$codeName : string
CodeName.
addChart(\PhpOffice\PhpSpreadsheet\Chart\Chart $pChart, null|int $iChartIndex = null) : \PhpOffice\PhpSpreadsheet\Chart\Chart
Add chart.
\PhpOffice\PhpSpreadsheet\Chart\Chart | $pChart | |
null|int | $iChartIndex | Index where chart should go (0,1,..., or null for last) |
setTitle(string $title, bool $updateFormulaCellReferences = true, bool $validate = true) : $this
Set title.
string | $title | String containing the dimension of this worksheet |
bool | $updateFormulaCellReferences | Flag indicating whether cell references in formulae should be updated to reflect the new sheet name. This should be left as the default true, unless you are certain that no formula cells on any worksheet contain references to this worksheet |
bool | $validate | False to skip validation of new title. WARNING: This should only be set at parse time (by Readers), where titles can be assumed to be valid. |
getHighestDataColumn(string $row = null) : string
Get highest worksheet column that contains data.
string | $row | Return the highest data column for the specified row, or the highest data column of any row if no row number is passed |
Highest column name that contains data
getHighestDataRow(string $column = null) : int
Get highest worksheet row that contains data.
string | $column | Return the highest data row for the specified column, or the highest data row of any column if no column letter is passed |
Highest row number that contains data
setCellValueByColumnAndRow(int $columnIndex, int $row, mixed $value) : $this
Set a cell value by using numeric cell coordinates.
int | $columnIndex | Numeric column coordinate of the cell |
int | $row | Numeric row coordinate of the cell |
mixed | $value | Value of the cell |
setCellValueExplicitByColumnAndRow(int $columnIndex, int $row, mixed $value, string $dataType) : $this
Set a cell value by using numeric cell coordinates.
int | $columnIndex | Numeric column coordinate of the cell |
int | $row | Numeric row coordinate of the cell |
mixed | $value | Value of the cell |
string | $dataType | Explicit data type, see DataType::TYPE_* |
getCell(string $pCoordinate, bool $createIfNotExists = true) : null|\PhpOffice\PhpSpreadsheet\Cell\Cell
Get cell at a specific coordinate.
string | $pCoordinate | Coordinate of the cell, eg: 'A1' |
bool | $createIfNotExists | Flag indicating whether a new cell should be created if it doesn't already exist, or a null should be returned instead |
Cell that was found/created or null
getCellByColumnAndRow(int $columnIndex, int $row, bool $createIfNotExists = true) : null|\PhpOffice\PhpSpreadsheet\Cell\Cell
Get cell at a specific coordinate by using numeric cell coordinates.
int | $columnIndex | Numeric column coordinate of the cell |
int | $row | Numeric row coordinate of the cell |
bool | $createIfNotExists | Flag indicating whether a new cell should be created if it doesn't already exist, or a null should be returned instead |
Cell that was found/created or null
getColumnDimension(string $pColumn, bool $create = true) : \PhpOffice\PhpSpreadsheet\Worksheet\ColumnDimension
Get column dimension at a specific column.
string | $pColumn | String index of the column eg: 'A' |
bool | $create |
getColumnDimensionByColumn(int $columnIndex) : \PhpOffice\PhpSpreadsheet\Worksheet\ColumnDimension
Get column dimension at a specific column by using numeric cell coordinates.
int | $columnIndex | Numeric column coordinate of the cell |
getStyleByColumnAndRow(int $columnIndex1, int $row1, null|int $columnIndex2 = null, null|int $row2 = null) : \PhpOffice\PhpSpreadsheet\Style\Style
Get style for cell by using numeric cell coordinates.
int | $columnIndex1 | Numeric column coordinate of the cell |
int | $row1 | Numeric row coordinate of the cell |
null|int | $columnIndex2 | Numeric column coordinate of the range cell |
null|int | $row2 | Numeric row coordinate of the range cell |
duplicateStyle(\PhpOffice\PhpSpreadsheet\Style\Style $pCellStyle, string $pRange) : $this
Duplicate cell style to a range of cells.
Please note that this will overwrite existing cell styles for cells in range!
\PhpOffice\PhpSpreadsheet\Style\Style | $pCellStyle | Cell style to duplicate |
string | $pRange | Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") |
duplicateConditionalStyle(\PhpOffice\PhpSpreadsheet\Style\Conditional[] $pCellStyle, string $pRange = '') : $this
Duplicate conditional style to a range of cells.
Please note that this will overwrite existing cell styles for cells in range!
\PhpOffice\PhpSpreadsheet\Style\Conditional[] | $pCellStyle | Cell style to duplicate |
string | $pRange | Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") |
setBreakByColumnAndRow(int $columnIndex, int $row, int $break) : $this
Set break on a cell by using numeric cell coordinates.
int | $columnIndex | Numeric column coordinate of the cell |
int | $row | Numeric row coordinate of the cell |
int | $break | Break type (type of Worksheet::BREAK_*) |
mergeCellsByColumnAndRow(int $columnIndex1, int $row1, int $columnIndex2, int $row2) : $this
Set merge on a cell range by using numeric cell coordinates.
int | $columnIndex1 | Numeric column coordinate of the first cell |
int | $row1 | Numeric row coordinate of the first cell |
int | $columnIndex2 | Numeric column coordinate of the last cell |
int | $row2 | Numeric row coordinate of the last cell |
unmergeCellsByColumnAndRow(int $columnIndex1, int $row1, int $columnIndex2, int $row2) : $this
Remove merge on a cell range by using numeric cell coordinates.
int | $columnIndex1 | Numeric column coordinate of the first cell |
int | $row1 | Numeric row coordinate of the first cell |
int | $columnIndex2 | Numeric column coordinate of the last cell |
int | $row2 | Numeric row coordinate of the last cell |
protectCells(string $pRange, string $pPassword, bool $pAlreadyHashed = false) : $this
Set protection on a cell range.
string | $pRange | Cell (e.g. A1) or cell range (e.g. A1:E1) |
string | $pPassword | Password to unlock the protection |
bool | $pAlreadyHashed | If the password has already been hashed, set this to true |
protectCellsByColumnAndRow(int $columnIndex1, int $row1, int $columnIndex2, int $row2, string $password, bool $alreadyHashed = false) : $this
Set protection on a cell range by using numeric cell coordinates.
int | $columnIndex1 | Numeric column coordinate of the first cell |
int | $row1 | Numeric row coordinate of the first cell |
int | $columnIndex2 | Numeric column coordinate of the last cell |
int | $row2 | Numeric row coordinate of the last cell |
string | $password | Password to unlock the protection |
bool | $alreadyHashed | If the password has already been hashed, set this to true |
unprotectCellsByColumnAndRow(int $columnIndex1, int $row1, int $columnIndex2, int $row2) : $this
Remove protection on a cell range by using numeric cell coordinates.
int | $columnIndex1 | Numeric column coordinate of the first cell |
int | $row1 | Numeric row coordinate of the first cell |
int | $columnIndex2 | Numeric column coordinate of the last cell |
int | $row2 | Numeric row coordinate of the last cell |
setAutoFilterByColumnAndRow(int $columnIndex1, int $row1, int $columnIndex2, int $row2) : $this
Set Autofilter Range by using numeric cell coordinates.
int | $columnIndex1 | Numeric column coordinate of the first cell |
int | $row1 | Numeric row coordinate of the first cell |
int | $columnIndex2 | Numeric column coordinate of the second cell |
int | $row2 | Numeric row coordinate of the second cell |
freezePane(null|string $cell, null|string $topLeftCell = null) : $this
Freeze Pane.
Examples:
null|string | $cell | Position of the split |
null|string | $topLeftCell | default position of the right bottom pane |
insertNewColumnBeforeByIndex(int $beforeColumnIndex, int $pNumCols = 1) : $this
Insert a new column, updating all possible related data.
int | $beforeColumnIndex | Insert before this one (numeric column coordinate of the cell) |
int | $pNumCols | Number of columns to insert |
getCommentByColumnAndRow(int $columnIndex, int $row) : \PhpOffice\PhpSpreadsheet\Comment
Get comment for cell by using numeric cell coordinates.
int | $columnIndex | Numeric column coordinate of the cell |
int | $row | Numeric row coordinate of the cell |
fromArray(array $source, mixed $nullValue = null, string $startCell = 'A1', bool $strictNullComparison = false) : $this
Fill worksheet from values in array.
array | $source | Source array |
mixed | $nullValue | Value in source array that stands for blank cell |
string | $startCell | Insert array starting from this cell address as the top left coordinate |
bool | $strictNullComparison | Apply strict comparison when testing for null values in the array |
rangeToArray(string $pRange, mixed $nullValue = null, bool $calculateFormulas = true, bool $formatData = true, bool $returnCellRef = false) : array
Create array from a range of cells.
string | $pRange | Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") |
mixed | $nullValue | Value returned in the array entry if a cell doesn't exist |
bool | $calculateFormulas | Should formulas be calculated? |
bool | $formatData | Should formatting be applied to cell values? |
bool | $returnCellRef | False - Return a simple array of rows and columns indexed by number counting from zero True - Return rows and columns indexed by their actual row and column IDs |
namedRangeToArray(string $definedName, mixed $nullValue = null, bool $calculateFormulas = true, bool $formatData = true, bool $returnCellRef = false) : array
Create array from a range of cells.
string | $definedName | The Named Range that should be returned |
mixed | $nullValue | Value returned in the array entry if a cell doesn't exist |
bool | $calculateFormulas | Should formulas be calculated? |
bool | $formatData | Should formatting be applied to cell values? |
bool | $returnCellRef | False - Return a simple array of rows and columns indexed by number counting from zero True - Return rows and columns indexed by their actual row and column IDs |
toArray(mixed $nullValue = null, bool $calculateFormulas = true, bool $formatData = true, bool $returnCellRef = false) : array
Create array from worksheet.
mixed | $nullValue | Value returned in the array entry if a cell doesn't exist |
bool | $calculateFormulas | Should formulas be calculated? |
bool | $formatData | Should formatting be applied to cell values? |
bool | $returnCellRef | False - Return a simple array of rows and columns indexed by number counting from zero True - Return rows and columns indexed by their actual row and column IDs |
getRowIterator(int $startRow = 1, int $endRow = null) : \PhpOffice\PhpSpreadsheet\Worksheet\RowIterator
Get row iterator.
int | $startRow | The row number at which to start iterating |
int | $endRow | The row number at which to stop iterating |
getColumnIterator(string $startColumn = 'A', string $endColumn = null) : \PhpOffice\PhpSpreadsheet\Worksheet\ColumnIterator
Get column iterator.
string | $startColumn | The column address at which to start iterating |
string | $endColumn | The column address at which to stop iterating |
extractSheetTitle(string $pRange, bool $returnRange = false) : mixed
Extract worksheet title from range.
Example: extractSheetTitle("testSheet!A1") ==> 'A1' Example: extractSheetTitle("'testSheet 1'!A1", true) ==> ['testSheet 1', 'A1'];
string | $pRange | Range to extract title from |
bool | $returnRange | Return range? (see example) |
setDataValidation(string $pCellCoordinate, ?\PhpOffice\PhpSpreadsheet\Cell\DataValidation $pDataValidation = null) : $this
Set data validation.
string | $pCellCoordinate | Cell coordinate to insert data validation, eg: 'A1' |
?\PhpOffice\PhpSpreadsheet\Cell\DataValidation | $pDataValidation |
setCodeName(string $pValue, bool $validate = true) : $this
Define the code name of the sheet.
string | $pValue | Same rule as Title minus space not allowed (but, like Excel, change silently space to underscore) |
bool | $validate | False to skip validation of new title. WARNING: This should only be set at parse time (by Readers), where titles can be assumed to be valid. |