Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

(no description)

File Size: 3079 lines (88 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Worksheet:: (143 methods):
  __construct()
  disconnectCells()
  __destruct()
  getCellCollection()
  getInvalidCharacters()
  checkSheetCodeName()
  checkSheetTitle()
  getCoordinates()
  getRowDimensions()
  getDefaultRowDimension()
  getColumnDimensions()
  getDefaultColumnDimension()
  getDrawingCollection()
  getChartCollection()
  addChart()
  getChartCount()
  getChartByIndex()
  getChartNames()
  getChartByName()
  refreshColumnDimensions()
  refreshRowDimensions()
  calculateWorksheetDimension()
  calculateWorksheetDataDimension()
  calculateColumnWidths()
  getParent()
  rebindParent()
  getTitle()
  setTitle()
  getSheetState()
  setSheetState()
  getPageSetup()
  setPageSetup()
  getPageMargins()
  setPageMargins()
  getHeaderFooter()
  setHeaderFooter()
  getSheetView()
  setSheetView()
  getProtection()
  setProtection()
  getHighestColumn()
  getHighestDataColumn()
  getHighestRow()
  getHighestDataRow()
  getHighestRowAndColumn()
  setCellValue()
  setCellValueByColumnAndRow()
  setCellValueExplicit()
  setCellValueExplicitByColumnAndRow()
  getCell()
  getCellByColumnAndRow()
  createNewCell()
  cellExists()
  cellExistsByColumnAndRow()
  getRowDimension()
  getColumnDimension()
  getColumnDimensionByColumn()
  getStyles()
  getStyle()
  getConditionalStyles()
  conditionalStylesExists()
  removeConditionalStyles()
  getConditionalStylesCollection()
  setConditionalStyles()
  getStyleByColumnAndRow()
  duplicateStyle()
  duplicateConditionalStyle()
  setBreak()
  setBreakByColumnAndRow()
  getBreaks()
  mergeCells()
  mergeCellsByColumnAndRow()
  unmergeCells()
  unmergeCellsByColumnAndRow()
  getMergeCells()
  setMergeCells()
  protectCells()
  protectCellsByColumnAndRow()
  unprotectCells()
  unprotectCellsByColumnAndRow()
  getProtectedCells()
  getAutoFilter()
  setAutoFilter()
  setAutoFilterByColumnAndRow()
  removeAutoFilter()
  getFreezePane()
  freezePane()
  freezePaneByColumnAndRow()
  unfreezePane()
  getTopLeftCell()
  insertNewRowBefore()
  insertNewColumnBefore()
  insertNewColumnBeforeByIndex()
  removeRow()
  removeColumn()
  removeColumnByIndex()
  getShowGridlines()
  setShowGridlines()
  getPrintGridlines()
  setPrintGridlines()
  getShowRowColHeaders()
  setShowRowColHeaders()
  getShowSummaryBelow()
  setShowSummaryBelow()
  getShowSummaryRight()
  setShowSummaryRight()
  getComments()
  setComments()
  getComment()
  getCommentByColumnAndRow()
  getActiveCell()
  getSelectedCells()
  setSelectedCell()
  setSelectedCells()
  setSelectedCellByColumnAndRow()
  getRightToLeft()
  setRightToLeft()
  fromArray()
  rangeToArray()
  namedRangeToArray()
  toArray()
  getRowIterator()
  getColumnIterator()
  garbageCollect()
  getHashCode()
  extractSheetTitle()
  getHyperlink()
  setHyperlink()
  hyperlinkExists()
  getHyperlinkCollection()
  getDataValidation()
  setDataValidation()
  dataValidationExists()
  getDataValidationCollection()
  shrinkRangeToFit()
  getTabColor()
  resetTabColor()
  isTabColorSet()
  copy()
  __clone()
  setCodeName()
  getCodeName()
  hasCodeName()


Class: Worksheet  - X-Ref

__construct(Spreadsheet $parent = null, $pTitle = 'Worksheet')   X-Ref
Create a new worksheet.

param: Spreadsheet $parent
param: string $pTitle

disconnectCells()   X-Ref
Disconnect all cells from this Worksheet object,
typically so that the worksheet object can be unset.


__destruct()   X-Ref
Code to execute when this worksheet is unset().


getCellCollection()   X-Ref
Return the cell collection.

return: Cells

getInvalidCharacters()   X-Ref
Get array of invalid characters for sheet title.

return: array

checkSheetCodeName($pValue)   X-Ref
Check sheet code name for valid Excel syntax.

param: string $pValue The string to check
return: string The valid string

checkSheetTitle($pValue)   X-Ref
Check sheet title for valid Excel syntax.

param: string $pValue The string to check
return: string The valid string

getCoordinates($sorted = true)   X-Ref
Get a sorted list of all cell coordinates currently held in the collection by row and column.

param: bool $sorted Also sort the cell collection?
return: string[]

getRowDimensions()   X-Ref
Get collection of row dimensions.

return: RowDimension[]

getDefaultRowDimension()   X-Ref
Get default row dimension.

return: RowDimension

getColumnDimensions()   X-Ref
Get collection of column dimensions.

return: ColumnDimension[]

getDefaultColumnDimension()   X-Ref
Get default column dimension.

return: ColumnDimension

getDrawingCollection()   X-Ref
Get collection of drawings.

return: BaseDrawing[]

getChartCollection()   X-Ref
Get collection of charts.

return: Chart[]

addChart(Chart $pChart, $iChartIndex = null)   X-Ref
Add chart.

param: Chart $pChart
param: null|int $iChartIndex Index where chart should go (0,1,..., or null for last)
return: Chart

getChartCount()   X-Ref
Return the count of charts on this worksheet.

return: int The number of charts

getChartByIndex($index)   X-Ref
Get a chart by its index position.

param: string $index Chart index position
return: Chart|false

getChartNames()   X-Ref
Return an array of the names of charts on this worksheet.

return: string[] The names of charts

getChartByName($chartName)   X-Ref
Get a chart by name.

param: string $chartName Chart name
return: Chart|false

refreshColumnDimensions()   X-Ref
Refresh column dimensions.

return: Worksheet

refreshRowDimensions()   X-Ref
Refresh row dimensions.

return: Worksheet

calculateWorksheetDimension()   X-Ref
Calculate worksheet dimension.

return: string String containing the dimension of this worksheet

calculateWorksheetDataDimension()   X-Ref
Calculate worksheet data dimension.

return: string String containing the dimension of this worksheet that actually contain data

calculateColumnWidths()   X-Ref
Calculate widths for auto-size columns.

return: Worksheet;

getParent()   X-Ref
Get parent.

return: Spreadsheet

rebindParent(Spreadsheet $parent)   X-Ref
Re-bind parent.

param: Spreadsheet $parent
return: Worksheet

getTitle()   X-Ref
Get title.

return: string

setTitle($pValue, $updateFormulaCellReferences = true, $validate = true)   X-Ref
Set title.

param: string $pValue String containing the dimension of this worksheet
param: bool $updateFormulaCellReferences Flag indicating whether cell references in formulae should
param: bool $validate False to skip validation of new title. WARNING: This should only be set
return: Worksheet

getSheetState()   X-Ref
Get sheet state.

return: string Sheet state (visible, hidden, veryHidden)

setSheetState($value)   X-Ref
Set sheet state.

param: string $value Sheet state (visible, hidden, veryHidden)
return: Worksheet

getPageSetup()   X-Ref
Get page setup.

return: PageSetup

setPageSetup(PageSetup $pValue)   X-Ref
Set page setup.

param: PageSetup $pValue
return: Worksheet

getPageMargins()   X-Ref
Get page margins.

return: PageMargins

setPageMargins(PageMargins $pValue)   X-Ref
Set page margins.

param: PageMargins $pValue
return: Worksheet

getHeaderFooter()   X-Ref
Get page header/footer.

return: HeaderFooter

setHeaderFooter(HeaderFooter $pValue)   X-Ref
Set page header/footer.

param: HeaderFooter $pValue
return: Worksheet

getSheetView()   X-Ref
Get sheet view.

return: SheetView

setSheetView(SheetView $pValue)   X-Ref
Set sheet view.

param: SheetView $pValue
return: Worksheet

getProtection()   X-Ref
Get Protection.

return: Protection

setProtection(Protection $pValue)   X-Ref
Set Protection.

param: Protection $pValue
return: Worksheet

getHighestColumn($row = null)   X-Ref
Get highest worksheet column.

param: string $row Return the data highest column for the specified row,
return: string Highest column name

getHighestDataColumn($row = null)   X-Ref
Get highest worksheet column that contains data.

param: string $row Return the highest data column for the specified row,
return: string Highest column name that contains data

getHighestRow($column = null)   X-Ref
Get highest worksheet row.

param: string $column Return the highest data row for the specified column,
return: int Highest row number

getHighestDataRow($column = null)   X-Ref
Get highest worksheet row that contains data.

param: string $column Return the highest data row for the specified column,
return: int Highest row number that contains data

getHighestRowAndColumn()   X-Ref
Get highest worksheet column and highest row that have cell records.

return: array Highest column name and highest row number

setCellValue($pCoordinate, $pValue)   X-Ref
Set a cell value.

param: string $pCoordinate Coordinate of the cell, eg: 'A1'
param: mixed $pValue Value of the cell
return: Worksheet

setCellValueByColumnAndRow($columnIndex, $row, $value)   X-Ref
Set a cell value by using numeric cell coordinates.

param: int $columnIndex Numeric column coordinate of the cell
param: int $row Numeric row coordinate of the cell
param: mixed $value Value of the cell
return: Worksheet

setCellValueExplicit($pCoordinate, $pValue, $pDataType)   X-Ref
Set a cell value.

param: string $pCoordinate Coordinate of the cell, eg: 'A1'
param: mixed $pValue Value of the cell
param: string $pDataType Explicit data type, see DataType::TYPE_*
return: Worksheet

setCellValueExplicitByColumnAndRow($columnIndex, $row, $value, $dataType)   X-Ref
Set a cell value by using numeric cell coordinates.

param: int $columnIndex Numeric column coordinate of the cell
param: int $row Numeric row coordinate of the cell
param: mixed $value Value of the cell
param: string $dataType Explicit data type, see DataType::TYPE_*
return: Worksheet

getCell($pCoordinate, $createIfNotExists = true)   X-Ref
Get cell at a specific coordinate.

param: string $pCoordinate Coordinate of the cell, eg: 'A1'
param: bool $createIfNotExists Flag indicating whether a new cell should be created if it doesn't
return: null|Cell Cell that was found/created or null

getCellByColumnAndRow($columnIndex, $row, $createIfNotExists = true)   X-Ref
Get cell at a specific coordinate by using numeric cell coordinates.

param: int $columnIndex Numeric column coordinate of the cell
param: int $row Numeric row coordinate of the cell
param: bool $createIfNotExists Flag indicating whether a new cell should be created if it doesn't
return: null|Cell Cell that was found/created or null

createNewCell($pCoordinate)   X-Ref
Create a new cell at the specified coordinate.

param: string $pCoordinate Coordinate of the cell
return: Cell Cell that was created

cellExists($pCoordinate)   X-Ref
Does the cell at a specific coordinate exist?

param: string $pCoordinate Coordinate of the cell eg: 'A1'
return: bool

cellExistsByColumnAndRow($columnIndex, $row)   X-Ref
Cell at a specific coordinate by using numeric cell coordinates exists?

param: int $columnIndex Numeric column coordinate of the cell
param: int $row Numeric row coordinate of the cell
return: bool

getRowDimension($pRow, $create = true)   X-Ref
Get row dimension at a specific row.

param: int $pRow Numeric index of the row
param: bool $create
return: RowDimension

getColumnDimension($pColumn, $create = true)   X-Ref
Get column dimension at a specific column.

param: string $pColumn String index of the column eg: 'A'
param: bool $create
return: ColumnDimension

getColumnDimensionByColumn($columnIndex)   X-Ref
Get column dimension at a specific column by using numeric cell coordinates.

param: int $columnIndex Numeric column coordinate of the cell
return: ColumnDimension

getStyles()   X-Ref
Get styles.

return: Style[]

getStyle($pCellCoordinate)   X-Ref
Get style for cell.

param: string $pCellCoordinate Cell coordinate (or range) to get style for, eg: 'A1'
return: Style

getConditionalStyles($pCoordinate)   X-Ref
Get conditional styles for a cell.

param: string $pCoordinate eg: 'A1'
return: Conditional[]

conditionalStylesExists($pCoordinate)   X-Ref
Do conditional styles exist for this cell?

param: string $pCoordinate eg: 'A1'
return: bool

removeConditionalStyles($pCoordinate)   X-Ref
Removes conditional styles for a cell.

param: string $pCoordinate eg: 'A1'
return: Worksheet

getConditionalStylesCollection()   X-Ref
Get collection of conditional styles.

return: array

setConditionalStyles($pCoordinate, $pValue)   X-Ref
Set conditional styles.

param: string $pCoordinate eg: 'A1'
param: $pValue Conditional[]
return: Worksheet

getStyleByColumnAndRow($columnIndex1, $row1, $columnIndex2 = null, $row2 = null)   X-Ref
Get style for cell by using numeric cell coordinates.

param: int $columnIndex1 Numeric column coordinate of the cell
param: int $row1 Numeric row coordinate of the cell
param: null|int $columnIndex2 Numeric column coordinate of the range cell
param: null|int $row2 Numeric row coordinate of the range cell
return: Style

duplicateStyle(Style $pCellStyle, $pRange)   X-Ref
Duplicate cell style to a range of cells.

Please note that this will overwrite existing cell styles for cells in range!

param: Style $pCellStyle Cell style to duplicate
param: string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
return: Worksheet

duplicateConditionalStyle(array $pCellStyle, $pRange = '')   X-Ref
Duplicate conditional style to a range of cells.

Please note that this will overwrite existing cell styles for cells in range!

param: Conditional[] $pCellStyle Cell style to duplicate
param: string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
return: Worksheet

setBreak($pCoordinate, $pBreak)   X-Ref
Set break on a cell.

param: string $pCoordinate Cell coordinate (e.g. A1)
param: int $pBreak Break type (type of Worksheet::BREAK_*)
return: Worksheet

setBreakByColumnAndRow($columnIndex, $row, $break)   X-Ref
Set break on a cell by using numeric cell coordinates.

param: int $columnIndex Numeric column coordinate of the cell
param: int $row Numeric row coordinate of the cell
param: int $break Break type (type of Worksheet::BREAK_*)
return: Worksheet

getBreaks()   X-Ref
Get breaks.

return: array[]

mergeCells($pRange)   X-Ref
Set merge on a cell range.

param: string $pRange Cell range (e.g. A1:E1)
return: Worksheet

mergeCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2)   X-Ref
Set merge on a cell range by using numeric cell coordinates.

param: int $columnIndex1 Numeric column coordinate of the first cell
param: int $row1 Numeric row coordinate of the first cell
param: int $columnIndex2 Numeric column coordinate of the last cell
param: int $row2 Numeric row coordinate of the last cell
return: Worksheet

unmergeCells($pRange)   X-Ref
Remove merge on a cell range.

param: string $pRange Cell range (e.g. A1:E1)
return: Worksheet

unmergeCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2)   X-Ref
Remove merge on a cell range by using numeric cell coordinates.

param: int $columnIndex1 Numeric column coordinate of the first cell
param: int $row1 Numeric row coordinate of the first cell
param: int $columnIndex2 Numeric column coordinate of the last cell
param: int $row2 Numeric row coordinate of the last cell
return: Worksheet

getMergeCells()   X-Ref
Get merge cells array.

return: array[]

setMergeCells(array $pValue)   X-Ref
Set merge cells array for the entire sheet. Use instead mergeCells() to merge
a single cell range.

param: array $pValue
return: Worksheet

protectCells($pRange, $pPassword, $pAlreadyHashed = false)   X-Ref
Set protection on a cell range.

param: string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1)
param: string $pPassword Password to unlock the protection
param: bool $pAlreadyHashed If the password has already been hashed, set this to true
return: Worksheet

protectCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2, $password, $alreadyHashed = false)   X-Ref
Set protection on a cell range by using numeric cell coordinates.

param: int $columnIndex1 Numeric column coordinate of the first cell
param: int $row1 Numeric row coordinate of the first cell
param: int $columnIndex2 Numeric column coordinate of the last cell
param: int $row2 Numeric row coordinate of the last cell
param: string $password Password to unlock the protection
param: bool $alreadyHashed If the password has already been hashed, set this to true
return: Worksheet

unprotectCells($pRange)   X-Ref
Remove protection on a cell range.

param: string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1)
return: Worksheet

unprotectCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2)   X-Ref
Remove protection on a cell range by using numeric cell coordinates.

param: int $columnIndex1 Numeric column coordinate of the first cell
param: int $row1 Numeric row coordinate of the first cell
param: int $columnIndex2 Numeric column coordinate of the last cell
param: int $row2 Numeric row coordinate of the last cell
return: Worksheet

getProtectedCells()   X-Ref
Get protected cells.

return: array[]

getAutoFilter()   X-Ref
Get Autofilter.

return: AutoFilter

setAutoFilter($pValue)   X-Ref
Set AutoFilter.

param: AutoFilter|string $pValue
return: Worksheet

setAutoFilterByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2)   X-Ref
Set Autofilter Range by using numeric cell coordinates.

param: int $columnIndex1 Numeric column coordinate of the first cell
param: int $row1 Numeric row coordinate of the first cell
param: int $columnIndex2 Numeric column coordinate of the second cell
param: int $row2 Numeric row coordinate of the second cell
return: Worksheet

removeAutoFilter()   X-Ref
Remove autofilter.

return: Worksheet

getFreezePane()   X-Ref
Get Freeze Pane.

return: string

freezePane($cell, $topLeftCell = null)   X-Ref
Freeze Pane.

Examples:

- A2 will freeze the rows above cell A2 (i.e row 1)
- B1 will freeze the columns to the left of cell B1 (i.e column A)
- B2 will freeze the rows above and to the left of cell B2 (i.e row 1 and column A)

param: null|string $cell Position of the split
param: null|string $topLeftCell default position of the right bottom pane
return: Worksheet

freezePaneByColumnAndRow($columnIndex, $row)   X-Ref
Freeze Pane by using numeric cell coordinates.

param: int $columnIndex Numeric column coordinate of the cell
param: int $row Numeric row coordinate of the cell
return: Worksheet

unfreezePane()   X-Ref
Unfreeze Pane.

return: Worksheet

getTopLeftCell()   X-Ref
Get the default position of the right bottom pane.

return: int

insertNewRowBefore($pBefore, $pNumRows = 1)   X-Ref
Insert a new row, updating all possible related data.

param: int $pBefore Insert before this one
param: int $pNumRows Number of rows to insert
return: Worksheet

insertNewColumnBefore($pBefore, $pNumCols = 1)   X-Ref
Insert a new column, updating all possible related data.

param: string $pBefore Insert before this one, eg: 'A'
param: int $pNumCols Number of columns to insert
return: Worksheet

insertNewColumnBeforeByIndex($beforeColumnIndex, $pNumCols = 1)   X-Ref
Insert a new column, updating all possible related data.

param: int $beforeColumnIndex Insert before this one (numeric column coordinate of the cell)
param: int $pNumCols Number of columns to insert
return: Worksheet

removeRow($pRow, $pNumRows = 1)   X-Ref
Delete a row, updating all possible related data.

param: int $pRow Remove starting with this one
param: int $pNumRows Number of rows to remove
return: Worksheet

removeColumn($pColumn, $pNumCols = 1)   X-Ref
Remove a column, updating all possible related data.

param: string $pColumn Remove starting with this one, eg: 'A'
param: int $pNumCols Number of columns to remove
return: Worksheet

removeColumnByIndex($columnIndex, $numColumns = 1)   X-Ref
Remove a column, updating all possible related data.

param: int $columnIndex Remove starting with this one (numeric column coordinate of the cell)
param: int $numColumns Number of columns to remove
return: Worksheet

getShowGridlines()   X-Ref
Show gridlines?

return: bool

setShowGridlines($pValue)   X-Ref
Set show gridlines.

param: bool $pValue Show gridlines (true/false)
return: Worksheet

getPrintGridlines()   X-Ref
Print gridlines?

return: bool

setPrintGridlines($pValue)   X-Ref
Set print gridlines.

param: bool $pValue Print gridlines (true/false)
return: Worksheet

getShowRowColHeaders()   X-Ref
Show row and column headers?

return: bool

setShowRowColHeaders($pValue)   X-Ref
Set show row and column headers.

param: bool $pValue Show row and column headers (true/false)
return: Worksheet

getShowSummaryBelow()   X-Ref
Show summary below? (Row/Column outlining).

return: bool

setShowSummaryBelow($pValue)   X-Ref
Set show summary below.

param: bool $pValue Show summary below (true/false)
return: Worksheet

getShowSummaryRight()   X-Ref
Show summary right? (Row/Column outlining).

return: bool

setShowSummaryRight($pValue)   X-Ref
Set show summary right.

param: bool $pValue Show summary right (true/false)
return: Worksheet

getComments()   X-Ref
Get comments.

return: Comment[]

setComments(array $pValue)   X-Ref
Set comments array for the entire sheet.

param: Comment[] $pValue
return: Worksheet

getComment($pCellCoordinate)   X-Ref
Get comment for cell.

param: string $pCellCoordinate Cell coordinate to get comment for, eg: 'A1'
return: Comment

getCommentByColumnAndRow($columnIndex, $row)   X-Ref
Get comment for cell by using numeric cell coordinates.

param: int $columnIndex Numeric column coordinate of the cell
param: int $row Numeric row coordinate of the cell
return: Comment

getActiveCell()   X-Ref
Get active cell.

return: string Example: 'A1'

getSelectedCells()   X-Ref
Get selected cells.

return: string

setSelectedCell($pCoordinate)   X-Ref
Selected cell.

param: string $pCoordinate Cell (i.e. A1)
return: Worksheet

setSelectedCells($pCoordinate)   X-Ref
Select a range of cells.

param: string $pCoordinate Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6'
return: Worksheet

setSelectedCellByColumnAndRow($columnIndex, $row)   X-Ref
Selected cell by using numeric cell coordinates.

param: int $columnIndex Numeric column coordinate of the cell
param: int $row Numeric row coordinate of the cell
return: Worksheet

getRightToLeft()   X-Ref
Get right-to-left.

return: bool

setRightToLeft($value)   X-Ref
Set right-to-left.

param: bool $value Right-to-left true/false
return: Worksheet

fromArray(array $source, $nullValue = null, $startCell = 'A1', $strictNullComparison = false)   X-Ref
Fill worksheet from values in array.

param: array $source Source array
param: mixed $nullValue Value in source array that stands for blank cell
param: string $startCell Insert array starting from this cell address as the top left coordinate
param: bool $strictNullComparison Apply strict comparison when testing for null values in the array
return: Worksheet

rangeToArray($pRange, $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false)   X-Ref
Create array from a range of cells.

param: string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
param: mixed $nullValue Value returned in the array entry if a cell doesn't exist
param: bool $calculateFormulas Should formulas be calculated?
param: bool $formatData Should formatting be applied to cell values?
param: bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero
return: array

namedRangeToArray($pNamedRange, $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false)   X-Ref
Create array from a range of cells.

param: string $pNamedRange Name of the Named Range
param: mixed $nullValue Value returned in the array entry if a cell doesn't exist
param: bool $calculateFormulas Should formulas be calculated?
param: bool $formatData Should formatting be applied to cell values?
param: bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero
return: array

toArray($nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false)   X-Ref
Create array from worksheet.

param: mixed $nullValue Value returned in the array entry if a cell doesn't exist
param: bool $calculateFormulas Should formulas be calculated?
param: bool $formatData Should formatting be applied to cell values?
param: bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero
return: array

getRowIterator($startRow = 1, $endRow = null)   X-Ref
Get row iterator.

param: int $startRow The row number at which to start iterating
param: int $endRow The row number at which to stop iterating
return: RowIterator

getColumnIterator($startColumn = 'A', $endColumn = null)   X-Ref
Get column iterator.

param: string $startColumn The column address at which to start iterating
param: string $endColumn The column address at which to stop iterating
return: ColumnIterator

garbageCollect()   X-Ref
Run PhpSpreadsheet garbage collector.

return: Worksheet

getHashCode()   X-Ref
Get hash code.

return: string Hash code

extractSheetTitle($pRange, $returnRange = false)   X-Ref
Extract worksheet title from range.

Example: extractSheetTitle("testSheet!A1") ==> 'A1'
Example: extractSheetTitle("'testSheet 1'!A1", true) ==> ['testSheet 1', 'A1'];

param: string $pRange Range to extract title from
param: bool $returnRange Return range? (see example)
return: mixed

getHyperlink($pCellCoordinate)   X-Ref
Get hyperlink.

param: string $pCellCoordinate Cell coordinate to get hyperlink for, eg: 'A1'
return: Hyperlink

setHyperlink($pCellCoordinate, Hyperlink $pHyperlink = null)   X-Ref
Set hyperlink.

param: string $pCellCoordinate Cell coordinate to insert hyperlink, eg: 'A1'
param: null|Hyperlink $pHyperlink
return: Worksheet

hyperlinkExists($pCoordinate)   X-Ref
Hyperlink at a specific coordinate exists?

param: string $pCoordinate eg: 'A1'
return: bool

getHyperlinkCollection()   X-Ref
Get collection of hyperlinks.

return: Hyperlink[]

getDataValidation($pCellCoordinate)   X-Ref
Get data validation.

param: string $pCellCoordinate Cell coordinate to get data validation for, eg: 'A1'
return: DataValidation

setDataValidation($pCellCoordinate, DataValidation $pDataValidation = null)   X-Ref
Set data validation.

param: string $pCellCoordinate Cell coordinate to insert data validation, eg: 'A1'
param: null|DataValidation $pDataValidation
return: Worksheet

dataValidationExists($pCoordinate)   X-Ref
Data validation at a specific coordinate exists?

param: string $pCoordinate eg: 'A1'
return: bool

getDataValidationCollection()   X-Ref
Get collection of data validations.

return: DataValidation[]

shrinkRangeToFit($range)   X-Ref
Accepts a range, returning it as a range that falls within the current highest row and column of the worksheet.

param: string $range
return: string Adjusted range value

getTabColor()   X-Ref
Get tab color.

return: Color

resetTabColor()   X-Ref
Reset tab color.

return: Worksheet

isTabColorSet()   X-Ref
Tab color set?

return: bool

copy()   X-Ref
Copy worksheet (!= clone!).

return: Worksheet

__clone()   X-Ref
Implement PHP __clone to create a deep clone, not just a shallow copy.


setCodeName($pValue, $validate = true)   X-Ref
Define the code name of the sheet.

param: string $pValue Same rule as Title minus space not allowed (but, like Excel, change
param: bool $validate False to skip validation of new title. WARNING: This should only be set
return: Worksheet

getCodeName()   X-Ref
Return the code name of the sheet.

return: null|string

hasCodeName()   X-Ref
Sheet has a code name ?

return: bool