\PHPExcel_Worksheet

PHPExcel_Worksheet

Copyright (c) 2006 - 2015 PHPExcel

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Summary

Methods
Properties
Constants
__construct()
disconnectCells()
__destruct()
getCellCacheController()
getInvalidCharacters()
getCellCollection()
sortCellCollection()
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()
cellExists()
cellExistsByColumnAndRow()
getRowDimension()
getColumnDimension()
getColumnDimensionByColumn()
getStyles()
getDefaultStyle()
setDefaultStyle()
getStyle()
getConditionalStyles()
conditionalStylesExists()
removeConditionalStyles()
getConditionalStylesCollection()
setConditionalStyles()
getStyleByColumnAndRow()
setSharedStyle()
duplicateStyle()
duplicateConditionalStyle()
duplicateStyleArray()
setBreak()
setBreakByColumnAndRow()
getBreaks()
mergeCells()
mergeCellsByColumnAndRow()
unmergeCells()
unmergeCellsByColumnAndRow()
getMergeCells()
setMergeCells()
protectCells()
protectCellsByColumnAndRow()
unprotectCells()
unprotectCellsByColumnAndRow()
getProtectedCells()
getAutoFilter()
setAutoFilter()
setAutoFilterByColumnAndRow()
removeAutoFilter()
getFreezePane()
freezePane()
freezePaneByColumnAndRow()
unfreezePane()
insertNewRowBefore()
insertNewColumnBefore()
insertNewColumnBeforeByIndex()
removeRow()
removeColumn()
removeColumnByIndex()
getShowGridlines()
setShowGridlines()
getPrintGridlines()
setPrintGridlines()
getShowRowColHeaders()
setShowRowColHeaders()
getShowSummaryBelow()
setShowSummaryBelow()
getShowSummaryRight()
setShowSummaryRight()
getComments()
setComments()
getComment()
getCommentByColumnAndRow()
getSelectedCell()
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()
No public properties found
BREAK_NONE
BREAK_ROW
BREAK_COLUMN
SHEETSTATE_VISIBLE
SHEETSTATE_HIDDEN
SHEETSTATE_VERYHIDDEN
No protected methods found
No protected properties found
N/A
checkSheetCodeName()
checkSheetTitle()
createNewCell()
$invalidCharacters
$parent
$cellCollection
$rowDimensions
$defaultRowDimension
$columnDimensions
$defaultColumnDimension
$drawingCollection
$chartCollection
$title
$sheetState
$pageSetup
$pageMargins
$headerFooter
$sheetView
$protection
$styles
$conditionalStylesCollection
$cellCollectionIsSorted
$breaks
$mergeCells
$protectedCells
$autoFilter
$freezePane
$showGridlines
$printGridlines
$showRowColHeaders
$showSummaryBelow
$showSummaryRight
$comments
$activeCell
$selectedCells
$cachedHighestColumn
$cachedHighestRow
$rightToLeft
$hyperlinkCollection
$dataValidationCollection
$tabColor
$dirty
$hash
$codeName
N/A

Constants

BREAK_NONE

BREAK_NONE = 0

BREAK_ROW

BREAK_ROW = 1

BREAK_COLUMN

BREAK_COLUMN = 2

SHEETSTATE_VISIBLE

SHEETSTATE_VISIBLE = 'visible'

SHEETSTATE_HIDDEN

SHEETSTATE_HIDDEN = 'hidden'

SHEETSTATE_VERYHIDDEN

SHEETSTATE_VERYHIDDEN = 'veryHidden'

Properties

$invalidCharacters

$invalidCharacters : array

Invalid characters in sheet title

Type

array

$parent

$parent : \PHPExcel

Parent spreadsheet

Type

\PHPExcel

$cellCollection

$cellCollection : \PHPExcel_CachedObjectStorage_xxx

Cacheable collection of cells

Type

\PHPExcel_CachedObjectStorage_xxx

$drawingCollection

$drawingCollection : array<mixed,\PHPExcel_Worksheet_BaseDrawing>

Collection of drawings

Type

array<mixed,\PHPExcel_Worksheet_BaseDrawing>

$chartCollection

$chartCollection : array<mixed,\PHPExcel_Chart>

Collection of Chart objects

Type

array<mixed,\PHPExcel_Chart>

$title

$title : string

Worksheet title

Type

string

$sheetState

$sheetState : string

Sheet state

Type

string

$styles

$styles : array<mixed,\PHPExcel_Style>

Collection of styles

Type

array<mixed,\PHPExcel_Style>

$conditionalStylesCollection

$conditionalStylesCollection : array

Conditional styles. Indexed by cell coordinate, e.g. 'A1'

Type

array

$cellCollectionIsSorted

$cellCollectionIsSorted : boolean

Is the current cell collection sorted already?

Type

boolean

$breaks

$breaks : array

Collection of breaks

Type

array

$mergeCells

$mergeCells : array

Collection of merged cell ranges

Type

array

$protectedCells

$protectedCells : array

Collection of protected cell ranges

Type

array

$freezePane

$freezePane : string

Freeze pane

Type

string

$showGridlines

$showGridlines : boolean

Show gridlines?

Type

boolean

$printGridlines

$printGridlines : boolean

Print gridlines?

Type

boolean

$showRowColHeaders

$showRowColHeaders : boolean

Show row and column headers?

Type

boolean

$showSummaryBelow

$showSummaryBelow : boolean

Show summary below? (Row/Column outline)

Type

boolean

$showSummaryRight

$showSummaryRight : boolean

Show summary right? (Row/Column outline)

Type

boolean

$comments

$comments : array<mixed,\PHPExcel_Comment>

Collection of comments

Type

array<mixed,\PHPExcel_Comment>

$activeCell

$activeCell : string

Active cell. (Only one!)

Type

string

$selectedCells

$selectedCells : string

Selected cells

Type

string

$cachedHighestColumn

$cachedHighestColumn : string

Cached highest column

Type

string

$cachedHighestRow

$cachedHighestRow : integer

Cached highest row

Type

integer

$rightToLeft

$rightToLeft : boolean

Right-to-left?

Type

boolean

$hyperlinkCollection

$hyperlinkCollection : array

Hyperlinks. Indexed by cell coordinate, e.g. 'A1'

Type

array

$dataValidationCollection

$dataValidationCollection : array

Data validation objects. Indexed by cell coordinate, e.g. 'A1'

Type

array

$dirty

$dirty : boolean

Dirty flag

Type

boolean

$hash

$hash : string

Hash

Type

string

$codeName

$codeName : string

CodeName

Type

string

Methods

__construct()

__construct(\PHPExcel  $pParent = null, string  $pTitle = 'Worksheet') 

Create a new worksheet

Parameters

\PHPExcel $pParent
string $pTitle

disconnectCells()

disconnectCells() 

Disconnect all cells from this PHPExcel_Worksheet object, typically so that the worksheet object can be unset

__destruct()

__destruct() 

Code to execute when this worksheet is unset()

getCellCacheController()

getCellCacheController() : \PHPExcel_CachedObjectStorage_xxx

Return the cache controller for the cell collection

Returns

\PHPExcel_CachedObjectStorage_xxx

getInvalidCharacters()

getInvalidCharacters() : array

Get array of invalid characters for sheet title

Returns

array

getCellCollection()

getCellCollection(boolean  $pSorted = true) : array<mixed,\PHPExcel_Cell>

Get collection of cells

Parameters

boolean $pSorted

Also sort the cell collection?

Returns

array<mixed,\PHPExcel_Cell>

sortCellCollection()

sortCellCollection() : \PHPExcel_Worksheet

Sort collection of cells

Returns

\PHPExcel_Worksheet

getRowDimensions()

getRowDimensions() : array<mixed,\PHPExcel_Worksheet_RowDimension>

Get collection of row dimensions

Returns

array<mixed,\PHPExcel_Worksheet_RowDimension>

getColumnDimensions()

getColumnDimensions() : array<mixed,\PHPExcel_Worksheet_ColumnDimension>

Get collection of column dimensions

Returns

array<mixed,\PHPExcel_Worksheet_ColumnDimension>

getDrawingCollection()

getDrawingCollection() : array<mixed,\PHPExcel_Worksheet_BaseDrawing>

Get collection of drawings

Returns

array<mixed,\PHPExcel_Worksheet_BaseDrawing>

getChartCollection()

getChartCollection() : array<mixed,\PHPExcel_Chart>

Get collection of charts

Returns

array<mixed,\PHPExcel_Chart>

addChart()

addChart(\PHPExcel_Chart  $pChart = null, integer|null  $iChartIndex = null) : \PHPExcel_Chart

Add chart

Parameters

\PHPExcel_Chart $pChart
integer|null $iChartIndex

Index where chart should go (0,1,..., or null for last)

Returns

\PHPExcel_Chart

getChartCount()

getChartCount() : integer

Return the count of charts on this worksheet

Returns

integer —

The number of charts

getChartByIndex()

getChartByIndex(string  $index = null) : false|\PHPExcel_Chart

Get a chart by its index position

Parameters

string $index

Chart index position

Throws

\PHPExcel_Exception

Returns

false|\PHPExcel_Chart

getChartNames()

getChartNames() : array<mixed,string>

Return an array of the names of charts on this worksheet

Throws

\PHPExcel_Exception

Returns

array<mixed,string> —

The names of charts

getChartByName()

getChartByName(string  $chartName = '') : false|\PHPExcel_Chart

Get a chart by name

Parameters

string $chartName

Chart name

Throws

\PHPExcel_Exception

Returns

false|\PHPExcel_Chart

refreshColumnDimensions()

refreshColumnDimensions() : \PHPExcel_Worksheet

Refresh column dimensions

Returns

\PHPExcel_Worksheet

refreshRowDimensions()

refreshRowDimensions() : \PHPExcel_Worksheet

Refresh row dimensions

Returns

\PHPExcel_Worksheet

calculateWorksheetDimension()

calculateWorksheetDimension() : string

Calculate worksheet dimension

Returns

string —

String containing the dimension of this worksheet

calculateWorksheetDataDimension()

calculateWorksheetDataDimension() : string

Calculate worksheet data dimension

Returns

string —

String containing the dimension of this worksheet that actually contain data

calculateColumnWidths()

calculateColumnWidths(boolean  $calculateMergeCells = false) : \PHPExcel_Worksheet;

Calculate widths for auto-size columns

Parameters

boolean $calculateMergeCells

Calculate merge cell width

Returns

\PHPExcel_Worksheet;

getParent()

getParent() : \PHPExcel

Get parent

Returns

\PHPExcel

rebindParent()

rebindParent(\PHPExcel  $parent) : \PHPExcel_Worksheet

Re-bind parent

Parameters

\PHPExcel $parent

Returns

\PHPExcel_Worksheet

getTitle()

getTitle() : string

Get title

Returns

string

setTitle()

setTitle(string  $pValue = 'Worksheet', string  $updateFormulaCellReferences = true) : \PHPExcel_Worksheet

Set title

Parameters

string $pValue

String containing the dimension of this worksheet

string $updateFormulaCellReferences

boolean 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

Returns

\PHPExcel_Worksheet

getSheetState()

getSheetState() : string

Get sheet state

Returns

string —

Sheet state (visible, hidden, veryHidden)

setSheetState()

setSheetState(string  $value = \PHPExcel_Worksheet::SHEETSTATE_VISIBLE) : \PHPExcel_Worksheet

Set sheet state

Parameters

string $value

Sheet state (visible, hidden, veryHidden)

Returns

\PHPExcel_Worksheet

getHighestColumn()

getHighestColumn(string  $row = null) : string

Get highest worksheet column

Parameters

string $row

Return the data highest column for the specified row, or the highest column of any row if no row number is passed

Returns

string —

Highest column name

getHighestDataColumn()

getHighestDataColumn(string  $row = null) : string

Get highest worksheet column that contains data

Parameters

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

Returns

string —

Highest column name that contains data

getHighestRow()

getHighestRow(string  $column = null) : integer

Get highest worksheet row

Parameters

string $column

Return the highest data row for the specified column, or the highest row of any column if no column letter is passed

Returns

integer —

Highest row number

getHighestDataRow()

getHighestDataRow(string  $column = null) : string

Get highest worksheet row that contains data

Parameters

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

Returns

string —

Highest row number that contains data

getHighestRowAndColumn()

getHighestRowAndColumn() : array

Get highest worksheet column and highest row that have cell records

Returns

array —

Highest column name and highest row number

setCellValue()

setCellValue(string  $pCoordinate = 'A1', mixed  $pValue = null, boolean  $returnCell = false) : \PHPExcel_Worksheet|\PHPExcel_Cell

Set a cell value

Parameters

string $pCoordinate

Coordinate of the cell

mixed $pValue

Value of the cell

boolean $returnCell

Return the worksheet (false, default) or the cell (true)

Returns

\PHPExcel_Worksheet|\PHPExcel_Cell

Depending on the last parameter being specified

setCellValueByColumnAndRow()

setCellValueByColumnAndRow(string  $pColumn, string  $pRow = 1, mixed  $pValue = null, boolean  $returnCell = false) : \PHPExcel_Worksheet|\PHPExcel_Cell

Set a cell value by using numeric cell coordinates

Parameters

string $pColumn

Numeric column coordinate of the cell (A = 0)

string $pRow

Numeric row coordinate of the cell

mixed $pValue

Value of the cell

boolean $returnCell

Return the worksheet (false, default) or the cell (true)

Returns

\PHPExcel_Worksheet|\PHPExcel_Cell

Depending on the last parameter being specified

setCellValueExplicit()

setCellValueExplicit(string  $pCoordinate = 'A1', mixed  $pValue = null, string  $pDataType = \PHPExcel_Cell_DataType::TYPE_STRING, boolean  $returnCell = false) : \PHPExcel_Worksheet|\PHPExcel_Cell

Set a cell value

Parameters

string $pCoordinate

Coordinate of the cell

mixed $pValue

Value of the cell

string $pDataType

Explicit data type

boolean $returnCell

Return the worksheet (false, default) or the cell (true)

Returns

\PHPExcel_Worksheet|\PHPExcel_Cell

Depending on the last parameter being specified

setCellValueExplicitByColumnAndRow()

setCellValueExplicitByColumnAndRow(string  $pColumn, string  $pRow = 1, mixed  $pValue = null, string  $pDataType = \PHPExcel_Cell_DataType::TYPE_STRING, boolean  $returnCell = false) : \PHPExcel_Worksheet|\PHPExcel_Cell

Set a cell value by using numeric cell coordinates

Parameters

string $pColumn

Numeric column coordinate of the cell

string $pRow

Numeric row coordinate of the cell

mixed $pValue

Value of the cell

string $pDataType

Explicit data type

boolean $returnCell

Return the worksheet (false, default) or the cell (true)

Returns

\PHPExcel_Worksheet|\PHPExcel_Cell

Depending on the last parameter being specified

getCell()

getCell(string  $pCoordinate = 'A1', boolean  $createIfNotExists = true) : null|\PHPExcel_Cell

Get cell at a specific coordinate

Parameters

string $pCoordinate

Coordinate of the cell

boolean $createIfNotExists

Flag indicating whether a new cell should be created if it doesn't already exist, or a null should be returned instead

Throws

\PHPExcel_Exception

Returns

null|\PHPExcel_Cell

Cell that was found/created or null

getCellByColumnAndRow()

getCellByColumnAndRow(string  $pColumn, string  $pRow = 1, boolean  $createIfNotExists = true) : null|\PHPExcel_Cell

Get cell at a specific coordinate by using numeric cell coordinates

Parameters

string $pColumn

Numeric column coordinate of the cell (starting from 0)

string $pRow

Numeric row coordinate of the cell

boolean $createIfNotExists

Flag indicating whether a new cell should be created if it doesn't already exist, or a null should be returned instead

Returns

null|\PHPExcel_Cell

Cell that was found/created or null

cellExists()

cellExists(string  $pCoordinate = 'A1') : boolean

Does the cell at a specific coordinate exist?

Parameters

string $pCoordinate

Coordinate of the cell

Throws

\PHPExcel_Exception

Returns

boolean

cellExistsByColumnAndRow()

cellExistsByColumnAndRow(string  $pColumn, string  $pRow = 1) : boolean

Cell at a specific coordinate by using numeric cell coordinates exists?

Parameters

string $pColumn

Numeric column coordinate of the cell

string $pRow

Numeric row coordinate of the cell

Returns

boolean

getRowDimension()

getRowDimension(integer  $pRow = 1,   $create = true) : \PHPExcel_Worksheet_RowDimension

Get row dimension at a specific row

Parameters

integer $pRow

Numeric index of the row

$create

Returns

\PHPExcel_Worksheet_RowDimension

getColumnDimension()

getColumnDimension(string  $pColumn = 'A',   $create = true) : \PHPExcel_Worksheet_ColumnDimension

Get column dimension at a specific column

Parameters

string $pColumn

String index of the column

$create

Returns

\PHPExcel_Worksheet_ColumnDimension

getColumnDimensionByColumn()

getColumnDimensionByColumn(string  $pColumn) : \PHPExcel_Worksheet_ColumnDimension

Get column dimension at a specific column by using numeric cell coordinates

Parameters

string $pColumn

Numeric column coordinate of the cell

Returns

\PHPExcel_Worksheet_ColumnDimension

getStyles()

getStyles() : array<mixed,\PHPExcel_Style>

Get styles

Returns

array<mixed,\PHPExcel_Style>

getDefaultStyle()

getDefaultStyle() : \PHPExcel_Style

Get default style of workbook.

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Style

setDefaultStyle()

setDefaultStyle(\PHPExcel_Style  $pValue) : \PHPExcel_Worksheet

Set default style - should only be used by PHPExcel_IReader implementations!

Parameters

\PHPExcel_Style $pValue

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

getStyle()

getStyle(string  $pCellCoordinate = 'A1') : \PHPExcel_Style

Get style for cell

Parameters

string $pCellCoordinate

Cell coordinate (or range) to get style for

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Style

getConditionalStyles()

getConditionalStyles(string  $pCoordinate = 'A1') : array<mixed,\PHPExcel_Style_Conditional>

Get conditional styles for a cell

Parameters

string $pCoordinate

Returns

array<mixed,\PHPExcel_Style_Conditional>

conditionalStylesExists()

conditionalStylesExists(string  $pCoordinate = 'A1') : boolean

Do conditional styles exist for this cell?

Parameters

string $pCoordinate

Returns

boolean

removeConditionalStyles()

removeConditionalStyles(string  $pCoordinate = 'A1') : \PHPExcel_Worksheet

Removes conditional styles for a cell

Parameters

string $pCoordinate

Returns

\PHPExcel_Worksheet

getConditionalStylesCollection()

getConditionalStylesCollection() : array

Get collection of conditional styles

Returns

array

setConditionalStyles()

setConditionalStyles(  $pCoordinate = 'A1',   $pValue) : \PHPExcel_Worksheet

Set conditional styles

Parameters

$pCoordinate

string E.g. 'A1'

$pValue

PHPExcel_Style_Conditional[]

Returns

\PHPExcel_Worksheet

getStyleByColumnAndRow()

getStyleByColumnAndRow(integer  $pColumn, integer  $pRow = 1,   $pColumn2 = null,   $pRow2 = null) : \PHPExcel_Style

Get style for cell by using numeric cell coordinates

Parameters

integer $pColumn

Numeric column coordinate of the cell

integer $pRow

Numeric row coordinate of the cell

$pColumn2
$pRow2

Returns

\PHPExcel_Style

setSharedStyle()

setSharedStyle(\PHPExcel_Style  $pSharedCellStyle = null, string  $pRange = '') : \PHPExcel_Worksheet

Set shared cell style to a range of cells

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

Parameters

\PHPExcel_Style $pSharedCellStyle

Cell style to share

string $pRange

Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

duplicateStyle()

duplicateStyle(\PHPExcel_Style  $pCellStyle = null, string  $pRange = '') : \PHPExcel_Worksheet

Duplicate cell style to a range of cells

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

Parameters

\PHPExcel_Style $pCellStyle

Cell style to duplicate

string $pRange

Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

duplicateConditionalStyle()

duplicateConditionalStyle(array  $pCellStyle = null, string  $pRange = '') : \PHPExcel_Worksheet

Duplicate conditional style to a range of cells

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

Parameters

array $pCellStyle
string $pRange

Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

duplicateStyleArray()

duplicateStyleArray(array  $pStyles = null, string  $pRange = '', boolean  $pAdvanced = true) : \PHPExcel_Worksheet

Duplicate cell style array to a range of cells

Please note that this will overwrite existing cell styles for cells in range, if they are in the styles array. For example, if you decide to set a range of cells to font bold, only include font bold in the styles array.

Parameters

array $pStyles

Array containing style information

string $pRange

Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")

boolean $pAdvanced

Advanced mode for setting borders.

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

setBreak()

setBreak(string  $pCell = 'A1', integer  $pBreak = \PHPExcel_Worksheet::BREAK_NONE) : \PHPExcel_Worksheet

Set break on a cell

Parameters

string $pCell

Cell coordinate (e.g. A1)

integer $pBreak

Break type (type of PHPExcelWorksheet::BREAK*)

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

setBreakByColumnAndRow()

setBreakByColumnAndRow(integer  $pColumn, integer  $pRow = 1, integer  $pBreak = \PHPExcel_Worksheet::BREAK_NONE) : \PHPExcel_Worksheet

Set break on a cell by using numeric cell coordinates

Parameters

integer $pColumn

Numeric column coordinate of the cell

integer $pRow

Numeric row coordinate of the cell

integer $pBreak

Break type (type of PHPExcelWorksheet::BREAK*)

Returns

\PHPExcel_Worksheet

getBreaks()

getBreaks() : array<mixed,array>

Get breaks

Returns

array<mixed,array>

mergeCells()

mergeCells(string  $pRange = 'A1:A1') : \PHPExcel_Worksheet

Set merge on a cell range

Parameters

string $pRange

Cell range (e.g. A1:E1)

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

mergeCellsByColumnAndRow()

mergeCellsByColumnAndRow(integer  $pColumn1, integer  $pRow1 = 1, integer  $pColumn2, integer  $pRow2 = 1) : \PHPExcel_Worksheet

Set merge on a cell range by using numeric cell coordinates

Parameters

integer $pColumn1

Numeric column coordinate of the first cell

integer $pRow1

Numeric row coordinate of the first cell

integer $pColumn2

Numeric column coordinate of the last cell

integer $pRow2

Numeric row coordinate of the last cell

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

unmergeCells()

unmergeCells(string  $pRange = 'A1:A1') : \PHPExcel_Worksheet

Remove merge on a cell range

Parameters

string $pRange

Cell range (e.g. A1:E1)

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

unmergeCellsByColumnAndRow()

unmergeCellsByColumnAndRow(integer  $pColumn1, integer  $pRow1 = 1, integer  $pColumn2, integer  $pRow2 = 1) : \PHPExcel_Worksheet

Remove merge on a cell range by using numeric cell coordinates

Parameters

integer $pColumn1

Numeric column coordinate of the first cell

integer $pRow1

Numeric row coordinate of the first cell

integer $pColumn2

Numeric column coordinate of the last cell

integer $pRow2

Numeric row coordinate of the last cell

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

getMergeCells()

getMergeCells() : array<mixed,array>

Get merge cells array.

Returns

array<mixed,array>

setMergeCells()

setMergeCells(  $pValue = array()) 

Set merge cells array for the entire sheet. Use instead mergeCells() to merge a single cell range.

Parameters

$pValue

protectCells()

protectCells(string  $pRange = 'A1', string  $pPassword = '', boolean  $pAlreadyHashed = false) : \PHPExcel_Worksheet

Set protection on a cell range

Parameters

string $pRange

Cell (e.g. A1) or cell range (e.g. A1:E1)

string $pPassword

Password to unlock the protection

boolean $pAlreadyHashed

If the password has already been hashed, set this to true

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

protectCellsByColumnAndRow()

protectCellsByColumnAndRow(integer  $pColumn1, integer  $pRow1 = 1, integer  $pColumn2, integer  $pRow2 = 1, string  $pPassword = '', boolean  $pAlreadyHashed = false) : \PHPExcel_Worksheet

Set protection on a cell range by using numeric cell coordinates

Parameters

integer $pColumn1

Numeric column coordinate of the first cell

integer $pRow1

Numeric row coordinate of the first cell

integer $pColumn2

Numeric column coordinate of the last cell

integer $pRow2

Numeric row coordinate of the last cell

string $pPassword

Password to unlock the protection

boolean $pAlreadyHashed

If the password has already been hashed, set this to true

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

unprotectCells()

unprotectCells(string  $pRange = 'A1') : \PHPExcel_Worksheet

Remove protection on a cell range

Parameters

string $pRange

Cell (e.g. A1) or cell range (e.g. A1:E1)

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

unprotectCellsByColumnAndRow()

unprotectCellsByColumnAndRow(integer  $pColumn1, integer  $pRow1 = 1, integer  $pColumn2, integer  $pRow2 = 1, string  $pPassword = '', boolean  $pAlreadyHashed = false) : \PHPExcel_Worksheet

Remove protection on a cell range by using numeric cell coordinates

Parameters

integer $pColumn1

Numeric column coordinate of the first cell

integer $pRow1

Numeric row coordinate of the first cell

integer $pColumn2

Numeric column coordinate of the last cell

integer $pRow2

Numeric row coordinate of the last cell

string $pPassword

Password to unlock the protection

boolean $pAlreadyHashed

If the password has already been hashed, set this to true

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

getProtectedCells()

getProtectedCells() : array<mixed,array>

Get protected cells

Returns

array<mixed,array>

getAutoFilter()

getAutoFilter() 

Get Autofilter

@return PHPExcel_Worksheet_AutoFilter

setAutoFilter()

setAutoFilter(  $pValue) 

Set AutoFilter

@param PHPExcel_Worksheet_AutoFilter|string $pValue A simple string containing a Cell range like 'A1:E10' is permitted for backward compatibility

Parameters

$pValue

Throws

\PHPExcel_Exception

@return PHPExcel_Worksheet

setAutoFilterByColumnAndRow()

setAutoFilterByColumnAndRow(  $pColumn1, integer  $pRow1 = 1,   $pColumn2,   $pRow2 = 1) 

Set Autofilter Range by using numeric cell coordinates

@param integer $pColumn1 Numeric column coordinate of the first cell

Parameters

$pColumn1
integer $pRow1

Numeric row coordinate of the first cell @param integer $pColumn2 Numeric column coordinate of the second cell @param integer $pRow2 Numeric row coordinate of the second cell @throws PHPExcel_Exception @return PHPExcel_Worksheet

$pColumn2
$pRow2

removeAutoFilter()

removeAutoFilter() : \PHPExcel_Worksheet

Remove autofilter

Returns

\PHPExcel_Worksheet

getFreezePane()

getFreezePane() : string

Get Freeze Pane

Returns

string

freezePane()

freezePane(string  $pCell = '') : \PHPExcel_Worksheet

Freeze Pane

Parameters

string $pCell

Cell (i.e. A2) 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 A2 (i.e row 1 and column A)

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

freezePaneByColumnAndRow()

freezePaneByColumnAndRow(integer  $pColumn, integer  $pRow = 1) : \PHPExcel_Worksheet

Freeze Pane by using numeric cell coordinates

Parameters

integer $pColumn

Numeric column coordinate of the cell

integer $pRow

Numeric row coordinate of the cell

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

unfreezePane()

unfreezePane() : \PHPExcel_Worksheet

Unfreeze Pane

Returns

\PHPExcel_Worksheet

insertNewRowBefore()

insertNewRowBefore(integer  $pBefore = 1, integer  $pNumRows = 1) : \PHPExcel_Worksheet

Insert a new row, updating all possible related data

Parameters

integer $pBefore

Insert before this one

integer $pNumRows

Number of rows to insert

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

insertNewColumnBefore()

insertNewColumnBefore(integer  $pBefore = 'A', integer  $pNumCols = 1) : \PHPExcel_Worksheet

Insert a new column, updating all possible related data

Parameters

integer $pBefore

Insert before this one

integer $pNumCols

Number of columns to insert

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

insertNewColumnBeforeByIndex()

insertNewColumnBeforeByIndex(integer  $pBefore, integer  $pNumCols = 1) : \PHPExcel_Worksheet

Insert a new column, updating all possible related data

Parameters

integer $pBefore

Insert before this one (numeric column coordinate of the cell)

integer $pNumCols

Number of columns to insert

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

removeRow()

removeRow(integer  $pRow = 1, integer  $pNumRows = 1) : \PHPExcel_Worksheet

Delete a row, updating all possible related data

Parameters

integer $pRow

Remove starting with this one

integer $pNumRows

Number of rows to remove

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

removeColumn()

removeColumn(string  $pColumn = 'A', integer  $pNumCols = 1) : \PHPExcel_Worksheet

Remove a column, updating all possible related data

Parameters

string $pColumn

Remove starting with this one

integer $pNumCols

Number of columns to remove

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

removeColumnByIndex()

removeColumnByIndex(integer  $pColumn, integer  $pNumCols = 1) : \PHPExcel_Worksheet

Remove a column, updating all possible related data

Parameters

integer $pColumn

Remove starting with this one (numeric column coordinate of the cell)

integer $pNumCols

Number of columns to remove

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

getShowGridlines()

getShowGridlines() : boolean

Show gridlines?

Returns

boolean

setShowGridlines()

setShowGridlines(boolean  $pValue = false) : \PHPExcel_Worksheet

Set show gridlines

Parameters

boolean $pValue

Show gridlines (true/false)

Returns

\PHPExcel_Worksheet

getPrintGridlines()

getPrintGridlines() : boolean

Print gridlines?

Returns

boolean

setPrintGridlines()

setPrintGridlines(boolean  $pValue = false) : \PHPExcel_Worksheet

Set print gridlines

Parameters

boolean $pValue

Print gridlines (true/false)

Returns

\PHPExcel_Worksheet

getShowRowColHeaders()

getShowRowColHeaders() : boolean

Show row and column headers?

Returns

boolean

setShowRowColHeaders()

setShowRowColHeaders(boolean  $pValue = false) : \PHPExcel_Worksheet

Set show row and column headers

Parameters

boolean $pValue

Show row and column headers (true/false)

Returns

\PHPExcel_Worksheet

getShowSummaryBelow()

getShowSummaryBelow() : boolean

Show summary below? (Row/Column outlining)

Returns

boolean

setShowSummaryBelow()

setShowSummaryBelow(boolean  $pValue = true) : \PHPExcel_Worksheet

Set show summary below

Parameters

boolean $pValue

Show summary below (true/false)

Returns

\PHPExcel_Worksheet

getShowSummaryRight()

getShowSummaryRight() : boolean

Show summary right? (Row/Column outlining)

Returns

boolean

setShowSummaryRight()

setShowSummaryRight(boolean  $pValue = true) : \PHPExcel_Worksheet

Set show summary right

Parameters

boolean $pValue

Show summary right (true/false)

Returns

\PHPExcel_Worksheet

getComments()

getComments() : array<mixed,\PHPExcel_Comment>

Get comments

Returns

array<mixed,\PHPExcel_Comment>

setComments()

setComments(  $pValue = array()) : \PHPExcel_Worksheet

Set comments array for the entire sheet.

Parameters

$pValue

Returns

\PHPExcel_Worksheet

getComment()

getComment(string  $pCellCoordinate = 'A1') : \PHPExcel_Comment

Get comment for cell

Parameters

string $pCellCoordinate

Cell coordinate to get comment for

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Comment

getCommentByColumnAndRow()

getCommentByColumnAndRow(integer  $pColumn, integer  $pRow = 1) : \PHPExcel_Comment

Get comment for cell by using numeric cell coordinates

Parameters

integer $pColumn

Numeric column coordinate of the cell

integer $pRow

Numeric row coordinate of the cell

Returns

\PHPExcel_Comment

getSelectedCell()

getSelectedCell() : string

Get selected cell

Returns

string

getActiveCell()

getActiveCell() : string

Get active cell

Returns

string —

Example: 'A1'

getSelectedCells()

getSelectedCells() : string

Get selected cells

Returns

string

setSelectedCell()

setSelectedCell(string  $pCoordinate = 'A1') : \PHPExcel_Worksheet

Selected cell

Parameters

string $pCoordinate

Cell (i.e. A1)

Returns

\PHPExcel_Worksheet

setSelectedCells()

setSelectedCells(string  $pCoordinate = 'A1') : \PHPExcel_Worksheet

Select a range of cells.

Parameters

string $pCoordinate

Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6'

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

setSelectedCellByColumnAndRow()

setSelectedCellByColumnAndRow(integer  $pColumn, integer  $pRow = 1) : \PHPExcel_Worksheet

Selected cell by using numeric cell coordinates

Parameters

integer $pColumn

Numeric column coordinate of the cell

integer $pRow

Numeric row coordinate of the cell

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

getRightToLeft()

getRightToLeft() : boolean

Get right-to-left

Returns

boolean

setRightToLeft()

setRightToLeft(boolean  $value = false) : \PHPExcel_Worksheet

Set right-to-left

Parameters

boolean $value

Right-to-left true/false

Returns

\PHPExcel_Worksheet

fromArray()

fromArray(array  $source = null, mixed  $nullValue = null, string  $startCell = 'A1', boolean  $strictNullComparison = false) : \PHPExcel_Worksheet

Fill worksheet from values in array

Parameters

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

boolean $strictNullComparison

Apply strict comparison when testing for null values in the array

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

rangeToArray()

rangeToArray(string  $pRange = 'A1', mixed  $nullValue = null, boolean  $calculateFormulas = true, boolean  $formatData = true, boolean  $returnCellRef = false) : array

Create array from a range of cells

Parameters

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

boolean $calculateFormulas

Should formulas be calculated?

boolean $formatData

Should formatting be applied to cell values?

boolean $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

Returns

array

namedRangeToArray()

namedRangeToArray(string  $pNamedRange = '', mixed  $nullValue = null, boolean  $calculateFormulas = true, boolean  $formatData = true, boolean  $returnCellRef = false) : array

Create array from a range of cells

Parameters

string $pNamedRange

Name of the Named Range

mixed $nullValue

Value returned in the array entry if a cell doesn't exist

boolean $calculateFormulas

Should formulas be calculated?

boolean $formatData

Should formatting be applied to cell values?

boolean $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

Throws

\PHPExcel_Exception

Returns

array

toArray()

toArray(mixed  $nullValue = null, boolean  $calculateFormulas = true, boolean  $formatData = true, boolean  $returnCellRef = false) : array

Create array from worksheet

Parameters

mixed $nullValue

Value returned in the array entry if a cell doesn't exist

boolean $calculateFormulas

Should formulas be calculated?

boolean $formatData

Should formatting be applied to cell values?

boolean $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

Returns

array

getRowIterator()

getRowIterator(integer  $startRow = 1, integer  $endRow = null) : \PHPExcel_Worksheet_RowIterator

Get row iterator

Parameters

integer $startRow

The row number at which to start iterating

integer $endRow

The row number at which to stop iterating

Returns

\PHPExcel_Worksheet_RowIterator

getColumnIterator()

getColumnIterator(string  $startColumn = 'A', string  $endColumn = null) : \PHPExcel_Worksheet_ColumnIterator

Get column iterator

Parameters

string $startColumn

The column address at which to start iterating

string $endColumn

The column address at which to stop iterating

Returns

\PHPExcel_Worksheet_ColumnIterator

garbageCollect()

garbageCollect() : \PHPExcel_Worksheet

Run PHPExcel garabage collector.

Returns

\PHPExcel_Worksheet

getHashCode()

getHashCode() : string

Get hash code

Returns

string —

Hash code

extractSheetTitle()

extractSheetTitle(string  $pRange, boolean  $returnRange = false) : mixed

Extract worksheet title from range.

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

Parameters

string $pRange

Range to extract title from

boolean $returnRange

Return range? (see example)

Returns

mixed

getHyperlink()

getHyperlink(string  $pCellCoordinate = 'A1') 

Get hyperlink

Parameters

string $pCellCoordinate

Cell coordinate to get hyperlink for

setHyperlink()

setHyperlink(string  $pCellCoordinate = 'A1', \PHPExcel_Cell_Hyperlink  $pHyperlink = null) : \PHPExcel_Worksheet

Set hyperlnk

Parameters

string $pCellCoordinate

Cell coordinate to insert hyperlink

\PHPExcel_Cell_Hyperlink $pHyperlink

Returns

\PHPExcel_Worksheet

hyperlinkExists()

hyperlinkExists(string  $pCoordinate = 'A1') : boolean

Hyperlink at a specific coordinate exists?

Parameters

string $pCoordinate

Returns

boolean

getHyperlinkCollection()

getHyperlinkCollection() : array<mixed,\PHPExcel_Cell_Hyperlink>

Get collection of hyperlinks

Returns

array<mixed,\PHPExcel_Cell_Hyperlink>

getDataValidation()

getDataValidation(string  $pCellCoordinate = 'A1') 

Get data validation

Parameters

string $pCellCoordinate

Cell coordinate to get data validation for

setDataValidation()

setDataValidation(string  $pCellCoordinate = 'A1', \PHPExcel_Cell_DataValidation  $pDataValidation = null) : \PHPExcel_Worksheet

Set data validation

Parameters

string $pCellCoordinate

Cell coordinate to insert data validation

\PHPExcel_Cell_DataValidation $pDataValidation

Returns

\PHPExcel_Worksheet

dataValidationExists()

dataValidationExists(string  $pCoordinate = 'A1') : boolean

Data validation at a specific coordinate exists?

Parameters

string $pCoordinate

Returns

boolean

getDataValidationCollection()

getDataValidationCollection() : array<mixed,\PHPExcel_Cell_DataValidation>

Get collection of data validations

Returns

array<mixed,\PHPExcel_Cell_DataValidation>

shrinkRangeToFit()

shrinkRangeToFit(string  $range) : string

Accepts a range, returning it as a range that falls within the current highest row and column of the worksheet

Parameters

string $range

Returns

string —

Adjusted range value

resetTabColor()

resetTabColor() : \PHPExcel_Worksheet

Reset tab color

Returns

\PHPExcel_Worksheet

isTabColorSet()

isTabColorSet() : boolean

Tab color set?

Returns

boolean

__clone()

__clone() 

Implement PHP __clone to create a deep clone, not just a shallow copy.

setCodeName()

setCodeName(  $pValue = null) : \objWorksheet

Define the code name of the sheet

Parameters

$pValue

Throws

\PHPExcel_Exception

Returns

\objWorksheet

getCodeName()

getCodeName() : null|string

Return the code name of the sheet

Returns

null|string

hasCodeName()

hasCodeName() : boolean

Sheet has a code name ?

Returns

boolean

checkSheetCodeName()

checkSheetCodeName(string  $pValue) : string

Check sheet code name for valid Excel syntax

Parameters

string $pValue

The string to check

Throws

\Exception

Returns

string —

The valid string

checkSheetTitle()

checkSheetTitle(string  $pValue) : string

Check sheet title for valid Excel syntax

Parameters

string $pValue

The string to check

Throws

\PHPExcel_Exception

Returns

string —

The valid string

createNewCell()

createNewCell(string  $pCoordinate) : \PHPExcel_Cell

Create a new cell at the specified coordinate

Parameters

string $pCoordinate

Coordinate of the cell

Returns

\PHPExcel_Cell

Cell that was created