PHPExcel classes » \PHPExcel_Worksheet

PHPExcel_Worksheet

category | PHPExcel
package | PHPExcel_Worksheet
copyright | Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)

### Methods

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

    __clone()

## Create a new worksheet

    __construct(\PHPExcel $pParent, string $pTitle)

### Parameters

#### $pParent

`\PHPExcel`

#### $pTitle

`string`

## Code to execute when this worksheet is unset()

    __destruct()

## Add chart

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

### Parameters

#### $pChart

`\PHPExcel_Chart`

#### $iChartIndex

`int` `null`

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

### Returns

`\PHPExcel_Chart`

## Calculate widths for auto-size columns

    calculateColumnWidths(boolean $calculateMergeCells) : \PHPExcel_Worksheet;

### Parameters

#### $calculateMergeCells

`boolean`

Calculate merge cell width

### Returns

`\PHPExcel_Worksheet;`

## Calculate worksheet data dimension

    calculateWorksheetDataDimension() : string

### Returns

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

## Calculate worksheet dimension

    calculateWorksheetDimension() : string

### Returns

`string`String containing the dimension of this worksheet

## Does the cell at a specific coordinate exist?

    cellExists(string $pCoordinate) : boolean

### Parameters

#### $pCoordinate

`string`

Coordinate of the cell

### Exceptions

`\PHPExcel_Exception` |

### Returns

`boolean`

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

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

### Parameters

#### $pColumn

`string`

Numeric column coordinate of the cell

#### $pRow

`string`

Numeric row coordinate of the cell

### Returns

`boolean`

## Do conditional styles exist for this cell?

    conditionalStylesExists(string $pCoordinate) : boolean

### Parameters

#### $pCoordinate

`string`

### Returns

`boolean`

## Copy worksheet (!= clone!)

    copy() : \PHPExcel_Worksheet

### Returns

`\PHPExcel_Worksheet`

## Data validation at a specific coordinate exists?

    dataValidationExists(string $pCoordinate) : boolean

### Parameters

#### $pCoordinate

`string`

### Returns

`boolean`

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

    disconnectCells()

## Duplicate conditional style to a range of cells

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

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

### Parameters

#### $pCellStyle

`array`

of PHPExcel_Style_Conditional $pCellStyle Cell style to duplicate

#### $pRange

`string`

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

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Duplicate cell style to a range of cells

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

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

### Parameters

#### $pCellStyle

`\PHPExcel_Style`

Cell style to duplicate

#### $pRange

`string`

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

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Duplicate cell style array to a range of cells

    duplicateStyleArray(array $pStyles, string $pRange, boolean $pAdvanced) : \PHPExcel_Worksheet

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.

deprecated |

### Parameters

#### $pStyles

`array`

Array containing style information

#### $pRange

`string`

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

#### $pAdvanced

`boolean`

Advanced mode for setting borders.

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Extract worksheet title from range.

    extractSheetTitle(string $pRange, bool $returnRange) : mixed

Static

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

### Parameters

#### $pRange

`string`

Range to extract title from

#### $returnRange

`bool`

Return range? (see example)

### Returns

`mixed`

## Freeze Pane

    freezePane(string $pCell) : \PHPExcel_Worksheet

### Parameters

#### $pCell

`string`

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)

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Freeze Pane by using numeric cell coordinates

    freezePaneByColumnAndRow(int $pColumn, int $pRow) : \PHPExcel_Worksheet

### Parameters

#### $pColumn

`int`

Numeric column coordinate of the cell

#### $pRow

`int`

Numeric row coordinate of the cell

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Fill worksheet from values in array

    fromArray(array $source, mixed $nullValue, string $startCell, boolean $strictNullComparison) : \PHPExcel_Worksheet

### Parameters

#### $source

`array`

Source array

#### $nullValue

`mixed`

Value in source array that stands for blank cell

#### $startCell

`string`

Insert array starting from this cell address as the top left coordinate

#### $strictNullComparison

`boolean`

Apply strict comparison when testing for null values in the array

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Run PHPExcel garabage collector.

    garbageCollect() : \PHPExcel_Worksheet

### Returns

`\PHPExcel_Worksheet`

## Get active cell

    getActiveCell() : string

### Returns

`string`Example: 'A1'

## Get Autofilter

    getAutoFilter()

@return PHPExcel_Worksheet_AutoFilter

## Get breaks

    getBreaks() : array[]

### Returns

`array[]`

## Get cell at a specific coordinate

    getCell(string $pCoordinate) : \PHPExcel_Cell

### Parameters

#### $pCoordinate

`string`

Coordinate of the cell

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Cell`Cell that was found

## Get cell at a specific coordinate by using numeric cell coordinates

    getCellByColumnAndRow(string $pColumn, string $pRow) : \PHPExcel_Cell

### Parameters

#### $pColumn

`string`

Numeric column coordinate of the cell

#### $pRow

`string`

Numeric row coordinate of the cell

### Returns

`\PHPExcel_Cell`Cell that was found

## Return the cache controller for the cell collection

    getCellCacheController() : \PHPExcel_CachedObjectStorage_xxx

### Returns

`\PHPExcel_CachedObjectStorage_xxx`

## Get collection of cells

    getCellCollection(boolean $pSorted) : \PHPExcel_Cell[]

### Parameters

#### $pSorted

`boolean`

Also sort the cell collection?

### Returns

`\PHPExcel_Cell[]`

## Get a chart by its index position

    getChartByIndex(string $index) : false | \PHPExcel_Chart

### Parameters

#### $index

`string`

Chart index position

### Exceptions

`\PHPExcel_Exception` |

### Returns

`false``\PHPExcel_Chart`

## Get a chart by name

    getChartByName(string $chartName) : false | \PHPExcel_Chart

### Parameters

#### $chartName

`string`

Chart name

### Exceptions

`\PHPExcel_Exception` |

### Returns

`false``\PHPExcel_Chart`

## Get collection of charts

    getChartCollection() : \PHPExcel_Chart[]

### Returns

`\PHPExcel_Chart[]`

## Return the count of charts on this worksheet

    getChartCount() : int

### Returns

`int`The number of charts

## Return an array of the names of charts on this worksheet

    getChartNames() : string[]

### Exceptions

`\PHPExcel_Exception` |

### Returns

`string[]`The names of charts

## Return the code name of the sheet

    getCodeName() : null | string

### Returns

`null` `string`

## Get column dimension at a specific column

    getColumnDimension(string $pColumn, $create) : \PHPExcel_Worksheet_ColumnDimension

### Parameters

#### $pColumn

`string`

String index of the column

#### $create

### Returns

`\PHPExcel_Worksheet_ColumnDimension`

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

    getColumnDimensionByColumn(string $pColumn) : \PHPExcel_Worksheet_ColumnDimension

### Parameters

#### $pColumn

`string`

Numeric column coordinate of the cell

### Returns

`\PHPExcel_Worksheet_ColumnDimension`

## Get collection of column dimensions

    getColumnDimensions() : \PHPExcel_Worksheet_ColumnDimension[]

### Returns

`\PHPExcel_Worksheet_ColumnDimension[]`

## Get comment for cell

    getComment(string $pCellCoordinate) : \PHPExcel_Comment

### Parameters

#### $pCellCoordinate

`string`

Cell coordinate to get comment for

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Comment`

## Get comment for cell by using numeric cell coordinates

    getCommentByColumnAndRow(int $pColumn, int $pRow) : \PHPExcel_Comment

### Parameters

#### $pColumn

`int`

Numeric column coordinate of the cell

#### $pRow

`int`

Numeric row coordinate of the cell

### Returns

`\PHPExcel_Comment`

## Get comments

    getComments() : \PHPExcel_Comment[]

### Returns

`\PHPExcel_Comment[]`

## Get conditional styles for a cell

    getConditionalStyles(string $pCoordinate) : \PHPExcel_Style_Conditional[]

### Parameters

#### $pCoordinate

`string`

### Returns

`\PHPExcel_Style_Conditional[]`

## Get collection of conditional styles

    getConditionalStylesCollection() : array

### Returns

`array`

## Get data validation

    getDataValidation(string $pCellCoordinate)

### Parameters

#### $pCellCoordinate

`string`

Cell coordinate to get data validation for

## Get collection of data validations

    getDataValidationCollection() : \PHPExcel_Cell_DataValidation[]

### Returns

`\PHPExcel_Cell_DataValidation[]`

## Get default column dimension

    getDefaultColumnDimension() : \PHPExcel_Worksheet_ColumnDimension

### Returns

`\PHPExcel_Worksheet_ColumnDimension`

## Get default row dimension

    getDefaultRowDimension() : \PHPExcel_Worksheet_RowDimension

### Returns

`\PHPExcel_Worksheet_RowDimension`

## Get default style of workbook.

    getDefaultStyle() : \PHPExcel_Style

deprecated |

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Style`

## Get collection of drawings

    getDrawingCollection() : \PHPExcel_Worksheet_BaseDrawing[]

### Returns

`\PHPExcel_Worksheet_BaseDrawing[]`

## Get Freeze Pane

    getFreezePane() : string

### Returns

`string`

## Get hash code

    getHashCode() : string

### Returns

`string`Hash code

## Get page header/footer

    getHeaderFooter() : \PHPExcel_Worksheet_HeaderFooter

### Returns

`\PHPExcel_Worksheet_HeaderFooter`

## Get highest worksheet column

    getHighestColumn(string $row) : string

### Parameters

#### $row

`string`

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

## Get highest worksheet column that contains data

    getHighestDataColumn(string $row) : string

### Parameters

#### $row

`string`

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

## Get highest worksheet row that contains data

    getHighestDataRow(string $column) : string

### Parameters

#### $column

`string`

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

## Get highest worksheet row

    getHighestRow(string $column) : int

### Parameters

#### $column

`string`

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

### Returns

`int`Highest row number

## Get highest worksheet column and highest row that have cell records

    getHighestRowAndColumn() : array

### Returns

`array`Highest column name and highest row number

## Get hyperlink

    getHyperlink(string $pCellCoordinate)

### Parameters

#### $pCellCoordinate

`string`

Cell coordinate to get hyperlink for

## Get collection of hyperlinks

    getHyperlinkCollection() : \PHPExcel_Cell_Hyperlink[]

### Returns

`\PHPExcel_Cell_Hyperlink[]`

## Get array of invalid characters for sheet title

    getInvalidCharacters() : array

Static

### Returns

`array`

## Get merge cells array.

    getMergeCells() : array[]

### Returns

`array[]`

## Get page margins

    getPageMargins() : \PHPExcel_Worksheet_PageMargins

### Returns

`\PHPExcel_Worksheet_PageMargins`

## Get page setup

    getPageSetup() : \PHPExcel_Worksheet_PageSetup

### Returns

`\PHPExcel_Worksheet_PageSetup`

## Get parent

    getParent() : \PHPExcel

### Returns

`\PHPExcel`

## Print gridlines?

    getPrintGridlines() : boolean

### Returns

`boolean`

## Get protected cells

    getProtectedCells() : array[]

### Returns

`array[]`

## Get Protection

    getProtection() : \PHPExcel_Worksheet_Protection

### Returns

`\PHPExcel_Worksheet_Protection`

## Get right-to-left

    getRightToLeft() : boolean

### Returns

`boolean`

## Get row dimension at a specific row

    getRowDimension(int $pRow, $create) : \PHPExcel_Worksheet_RowDimension

### Parameters

#### $pRow

`int`

Numeric index of the row

#### $create

### Returns

`\PHPExcel_Worksheet_RowDimension`

## Get collection of row dimensions

    getRowDimensions() : \PHPExcel_Worksheet_RowDimension[]

### Returns

`\PHPExcel_Worksheet_RowDimension[]`

## Get row iterator

    getRowIterator(integer $startRow) : \PHPExcel_Worksheet_RowIterator

### Parameters

#### $startRow

`integer`

The row number at which to start iterating

### Returns

`\PHPExcel_Worksheet_RowIterator`

## Get selected cell

    getSelectedCell() : string

deprecated |

### Returns

`string`

## Get selected cells

    getSelectedCells() : string

### Returns

`string`

## Get sheet state

    getSheetState() : string

### Returns

`string`Sheet state (visible, hidden, veryHidden)

## Get sheet view

    getSheetView() : \PHPExcel_Worksheet_SheetView

### Returns

`\PHPExcel_Worksheet_SheetView`

## Show gridlines?

    getShowGridlines() : boolean

### Returns

`boolean`

## Show row and column headers?

    getShowRowColHeaders() : boolean

### Returns

`boolean`

## Show summary below? (Row/Column outlining)

    getShowSummaryBelow() : boolean

### Returns

`boolean`

## Show summary right? (Row/Column outlining)

    getShowSummaryRight() : boolean

### Returns

`boolean`

## Get style for cell

    getStyle(string $pCellCoordinate) : \PHPExcel_Style

### Parameters

#### $pCellCoordinate

`string`

Cell coordinate to get style for

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Style`

## Get style for cell by using numeric cell coordinates

    getStyleByColumnAndRow(int $pColumn, int $pRow) : \PHPExcel_Style

### Parameters

#### $pColumn

`int`

Numeric column coordinate of the cell

#### $pRow

`int`

Numeric row coordinate of the cell

### Returns

`\PHPExcel_Style`

## Get styles

    getStyles() : \PHPExcel_Style[]

### Returns

`\PHPExcel_Style[]`

## Get tab color

    getTabColor() : \PHPExcel_Style_Color

### Returns

`\PHPExcel_Style_Color`

## Get title

    getTitle() : string

### Returns

`string`

## Sheet has a code name ?

    hasCodeName() : boolean

### Returns

`boolean`

## Hyperlink at a specific coordinate exists?

    hyperlinkExists(string $pCoordinate) : boolean

### Parameters

#### $pCoordinate

`string`

### Returns

`boolean`

## Insert a new column, updating all possible related data

    insertNewColumnBefore(int $pBefore, int $pNumCols) : \PHPExcel_Worksheet

### Parameters

#### $pBefore

`int`

Insert before this one

#### $pNumCols

`int`

Number of columns to insert

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Insert a new column, updating all possible related data

    insertNewColumnBeforeByIndex(int $pBefore, int $pNumCols) : \PHPExcel_Worksheet

### Parameters

#### $pBefore

`int`

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

#### $pNumCols

`int`

Number of columns to insert

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Insert a new row, updating all possible related data

    insertNewRowBefore(int $pBefore, int $pNumRows) : \PHPExcel_Worksheet

### Parameters

#### $pBefore

`int`

Insert before this one

#### $pNumRows

`int`

Number of rows to insert

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Tab color set?

    isTabColorSet() : boolean

### Returns

`boolean`

## Set merge on a cell range

    mergeCells(string $pRange) : \PHPExcel_Worksheet

### Parameters

#### $pRange

`string`

Cell range (e.g. A1:E1)

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Set merge on a cell range by using numeric cell coordinates

    mergeCellsByColumnAndRow(int $pColumn1, int $pRow1, int $pColumn2, int $pRow2) : \PHPExcel_Worksheet

### Parameters

#### $pColumn1

`int`

Numeric column coordinate of the first cell

#### $pRow1

`int`

Numeric row coordinate of the first cell

#### $pColumn2

`int`

Numeric column coordinate of the last cell

#### $pRow2

`int`

Numeric row coordinate of the last cell

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Create array from a range of cells

    namedRangeToArray(string $pNamedRange, mixed $nullValue, boolean $calculateFormulas, boolean $formatData, boolean $returnCellRef) : array

### Parameters

#### $pNamedRange

`string`

Name of the Named Range

#### $nullValue

`mixed`

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

#### $calculateFormulas

`boolean`

Should formulas be calculated?

#### $formatData

`boolean`

Should formatting be applied to cell values?

#### $returnCellRef

`boolean`

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

### Exceptions

`\PHPExcel_Exception` |

### Returns

`array`

## Set protection on a cell range

    protectCells(string $pRange, string $pPassword, boolean $pAlreadyHashed) : \PHPExcel_Worksheet

### Parameters

#### $pRange

`string`

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

#### $pPassword

`string`

Password to unlock the protection

#### $pAlreadyHashed

`boolean`

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

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Set protection on a cell range by using numeric cell coordinates

    protectCellsByColumnAndRow(int $pColumn1, int $pRow1, int $pColumn2, int $pRow2, string $pPassword, boolean $pAlreadyHashed) : \PHPExcel_Worksheet

### Parameters

#### $pColumn1

`int`

Numeric column coordinate of the first cell

#### $pRow1

`int`

Numeric row coordinate of the first cell

#### $pColumn2

`int`

Numeric column coordinate of the last cell

#### $pRow2

`int`

Numeric row coordinate of the last cell

#### $pPassword

`string`

Password to unlock the protection

#### $pAlreadyHashed

`boolean`

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

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Create array from a range of cells

    rangeToArray(string $pRange, mixed $nullValue, boolean $calculateFormulas, boolean $formatData, boolean $returnCellRef) : array

### Parameters

#### $pRange

`string`

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

#### $nullValue

`mixed`

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

#### $calculateFormulas

`boolean`

Should formulas be calculated?

#### $formatData

`boolean`

Should formatting be applied to cell values?

#### $returnCellRef

`boolean`

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`

## Re-bind parent

    rebindParent(\PHPExcel $parent) : \PHPExcel_Worksheet

### Parameters

#### $parent

`\PHPExcel`

### Returns

`\PHPExcel_Worksheet`

## Refresh column dimensions

    refreshColumnDimensions() : \PHPExcel_Worksheet

### Returns

`\PHPExcel_Worksheet`

## Refresh row dimensions

    refreshRowDimensions() : \PHPExcel_Worksheet

### Returns

`\PHPExcel_Worksheet`

## Remove autofilter

    removeAutoFilter() : \PHPExcel_Worksheet

### Returns

`\PHPExcel_Worksheet`

## Remove a column, updating all possible related data

    removeColumn(int $pColumn, int $pNumCols) : \PHPExcel_Worksheet

### Parameters

#### $pColumn

`int`

Remove starting with this one

#### $pNumCols

`int`

Number of columns to remove

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Remove a column, updating all possible related data

    removeColumnByIndex(int $pColumn, int $pNumCols) : \PHPExcel_Worksheet

### Parameters

#### $pColumn

`int`

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

#### $pNumCols

`int`

Number of columns to remove

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Removes conditional styles for a cell

    removeConditionalStyles(string $pCoordinate) : \PHPExcel_Worksheet

### Parameters

#### $pCoordinate

`string`

### Returns

`\PHPExcel_Worksheet`

## Delete a row, updating all possible related data

    removeRow(int $pRow, int $pNumRows) : \PHPExcel_Worksheet

### Parameters

#### $pRow

`int`

Remove starting with this one

#### $pNumRows

`int`

Number of rows to remove

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Reset tab color

    resetTabColor() : \PHPExcel_Worksheet

### Returns

`\PHPExcel_Worksheet`

## Set AutoFilter

    setAutoFilter($pValue)

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

### Parameters

#### $pValue

### Exceptions

`\PHPExcel_Exception` | @return PHPExcel_Worksheet

## Set Autofilter Range by using numeric cell coordinates

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

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

### Parameters

#### $pColumn1

#### $pRow1

`integer`

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

## Set break on a cell

    setBreak(string $pCell, int $pBreak) : \PHPExcel_Worksheet

### Parameters

#### $pCell

`string`

Cell coordinate (e.g. A1)

#### $pBreak

`int`

Break type (type of PHPExcel_Worksheet::BREAK_*)

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Set break on a cell by using numeric cell coordinates

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

### Parameters

#### $pColumn

`integer`

Numeric column coordinate of the cell

#### $pRow

`integer`

Numeric row coordinate of the cell

#### $pBreak

`integer`

Break type (type of PHPExcel_Worksheet::BREAK_*)

### Returns

`\PHPExcel_Worksheet`

## Set a cell value

    setCellValue(string $pCoordinate, mixed $pValue, bool $returnCell) : \PHPExcel_Worksheet | \PHPExcel_Cell

### Parameters

#### $pCoordinate

`string`

Coordinate of the cell

#### $pValue

`mixed`

Value of the cell

#### $returnCell

`bool`

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

### Returns

`\PHPExcel_Worksheet``\PHPExcel_Cell`Depending on the last parameter being specified

## Set a cell value by using numeric cell coordinates

    setCellValueByColumnAndRow(string $pColumn, string $pRow, mixed $pValue, bool $returnCell) : \PHPExcel_Worksheet | \PHPExcel_Cell

### Parameters

#### $pColumn

`string`

Numeric column coordinate of the cell (A = 0)

#### $pRow

`string`

Numeric row coordinate of the cell

#### $pValue

`mixed`

Value of the cell

#### $returnCell

`bool`

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

### Returns

`\PHPExcel_Worksheet``\PHPExcel_Cell`Depending on the last parameter being specified

## Set a cell value

    setCellValueExplicit(string $pCoordinate, mixed $pValue, string $pDataType, bool $returnCell) : \PHPExcel_Worksheet | \PHPExcel_Cell

### Parameters

#### $pCoordinate

`string`

Coordinate of the cell

#### $pValue

`mixed`

Value of the cell

#### $pDataType

`string`

Explicit data type

#### $returnCell

`bool`

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

### Returns

`\PHPExcel_Worksheet``\PHPExcel_Cell`Depending on the last parameter being specified

## Set a cell value by using numeric cell coordinates

    setCellValueExplicitByColumnAndRow(string $pColumn, string $pRow, mixed $pValue, string $pDataType, bool $returnCell) : \PHPExcel_Worksheet | \PHPExcel_Cell

### Parameters

#### $pColumn

`string`

Numeric column coordinate of the cell

#### $pRow

`string`

Numeric row coordinate of the cell

#### $pValue

`mixed`

Value of the cell

#### $pDataType

`string`

Explicit data type

#### $returnCell

`bool`

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

### Returns

`\PHPExcel_Worksheet``\PHPExcel_Cell`Depending on the last parameter being specified

## Define the code name of the sheet

    setCodeName(null | string $pValue) : \objWorksheet

### Parameters

#### $pValue

`null` `string`

Same rule as Title minus space not allowed (but, like Excel, change silently space to underscore)

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\objWorksheet`

## Set comments array for the entire sheet.

    setComments(array $pValue) : \PHPExcel_Worksheet

### Parameters

#### $pValue

`array`

of PHPExcel_Comment

### Returns

`\PHPExcel_Worksheet`

## Set conditional styles

    setConditionalStyles($pCoordinate, $pValue) : \PHPExcel_Worksheet

### Parameters

#### $pCoordinate

string E.g. 'A1'

#### $pValue

PHPExcel_Style_Conditional[]

### Returns

`\PHPExcel_Worksheet`

## Set data validation

    setDataValidation(string $pCellCoordinate, \PHPExcel_Cell_DataValidation $pDataValidation) : \PHPExcel_Worksheet

### Parameters

#### $pCellCoordinate

`string`

Cell coordinate to insert data validation

#### $pDataValidation

`\PHPExcel_Cell_DataValidation`

### Returns

`\PHPExcel_Worksheet`

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

    setDefaultStyle(\PHPExcel_Style $pValue) : \PHPExcel_Worksheet

deprecated |

### Parameters

#### $pValue

`\PHPExcel_Style`

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Set page header/footer

    setHeaderFooter(\PHPExcel_Worksheet_HeaderFooter $pValue) : \PHPExcel_Worksheet

### Parameters

#### $pValue

`\PHPExcel_Worksheet_HeaderFooter`

### Returns

`\PHPExcel_Worksheet`

## Set hyperlnk

    setHyperlink(string $pCellCoordinate, \PHPExcel_Cell_Hyperlink $pHyperlink) : \PHPExcel_Worksheet

### Parameters

#### $pCellCoordinate

`string`

Cell coordinate to insert hyperlink

#### $pHyperlink

`\PHPExcel_Cell_Hyperlink`

### Returns

`\PHPExcel_Worksheet`

## Set merge cells array for the entire sheet.

    setMergeCells(array $pValue)

Use instead mergeCells() to merge a single cell range.

### Parameters

#### $pValue

`array`

## Set page margins

    setPageMargins(\PHPExcel_Worksheet_PageMargins $pValue) : \PHPExcel_Worksheet

### Parameters

#### $pValue

`\PHPExcel_Worksheet_PageMargins`

### Returns

`\PHPExcel_Worksheet`

## Set page setup

    setPageSetup(\PHPExcel_Worksheet_PageSetup $pValue) : \PHPExcel_Worksheet

### Parameters

#### $pValue

`\PHPExcel_Worksheet_PageSetup`

### Returns

`\PHPExcel_Worksheet`

## Set print gridlines

    setPrintGridlines(boolean $pValue) : \PHPExcel_Worksheet

### Parameters

#### $pValue

`boolean`

Print gridlines (true/false)

### Returns

`\PHPExcel_Worksheet`

## Set Protection

    setProtection(\PHPExcel_Worksheet_Protection $pValue) : \PHPExcel_Worksheet

### Parameters

#### $pValue

`\PHPExcel_Worksheet_Protection`

### Returns

`\PHPExcel_Worksheet`

## Set right-to-left

    setRightToLeft(boolean $value) : \PHPExcel_Worksheet

### Parameters

#### $value

`boolean`

Right-to-left true/false

### Returns

`\PHPExcel_Worksheet`

## Selected cell

    setSelectedCell(string $pCoordinate) : \PHPExcel_Worksheet

### Parameters

#### $pCoordinate

`string`

Cell (i.e. A1)

### Returns

`\PHPExcel_Worksheet`

## Selected cell by using numeric cell coordinates

    setSelectedCellByColumnAndRow(int $pColumn, int $pRow) : \PHPExcel_Worksheet

### Parameters

#### $pColumn

`int`

Numeric column coordinate of the cell

#### $pRow

`int`

Numeric row coordinate of the cell

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Select a range of cells.

    setSelectedCells(string $pCoordinate) : \PHPExcel_Worksheet

### Parameters

#### $pCoordinate

`string`

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

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Set shared cell style to a range of cells

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

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

deprecated |

### Parameters

#### $pSharedCellStyle

`\PHPExcel_Style`

Cell style to share

#### $pRange

`string`

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

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Set sheet state

    setSheetState(string $value) : \PHPExcel_Worksheet

### Parameters

#### $value

`string`

Sheet state (visible, hidden, veryHidden)

### Returns

`\PHPExcel_Worksheet`

## Set sheet view

    setSheetView(\PHPExcel_Worksheet_SheetView $pValue) : \PHPExcel_Worksheet

### Parameters

#### $pValue

`\PHPExcel_Worksheet_SheetView`

### Returns

`\PHPExcel_Worksheet`

## Set show gridlines

    setShowGridlines(boolean $pValue) : \PHPExcel_Worksheet

### Parameters

#### $pValue

`boolean`

Show gridlines (true/false)

### Returns

`\PHPExcel_Worksheet`

## Set show row and column headers

    setShowRowColHeaders(boolean $pValue) : \PHPExcel_Worksheet

### Parameters

#### $pValue

`boolean`

Show row and column headers (true/false)

### Returns

`\PHPExcel_Worksheet`

## Set show summary below

    setShowSummaryBelow(boolean $pValue) : \PHPExcel_Worksheet

### Parameters

#### $pValue

`boolean`

Show summary below (true/false)

### Returns

`\PHPExcel_Worksheet`

## Set show summary right

    setShowSummaryRight(boolean $pValue) : \PHPExcel_Worksheet

### Parameters

#### $pValue

`boolean`

Show summary right (true/false)

### Returns

`\PHPExcel_Worksheet`

## Set title

    setTitle(string $pValue, string $updateFormulaCellReferences) : \PHPExcel_Worksheet

### Parameters

#### $pValue

`string`

String containing the dimension of this worksheet

#### $updateFormulaCellReferences

`string`

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`

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

    shrinkRangeToFit(string $range) : string

### Parameters

#### $range

`string`

### Returns

`string`Adjusted range value

## Sort collection of cells

    sortCellCollection() : \PHPExcel_Worksheet

### Returns

`\PHPExcel_Worksheet`

## Create array from worksheet

    toArray(mixed $nullValue, boolean $calculateFormulas, boolean $formatData, boolean $returnCellRef) : array

### Parameters

#### $nullValue

`mixed`

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

#### $calculateFormulas

`boolean`

Should formulas be calculated?

#### $formatData

`boolean`

Should formatting be applied to cell values?

#### $returnCellRef

`boolean`

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`

## Unfreeze Pane

    unfreezePane() : \PHPExcel_Worksheet

### Returns

`\PHPExcel_Worksheet`

## Remove merge on a cell range

    unmergeCells(string $pRange) : \PHPExcel_Worksheet

### Parameters

#### $pRange

`string`

Cell range (e.g. A1:E1)

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Remove merge on a cell range by using numeric cell coordinates

    unmergeCellsByColumnAndRow(int $pColumn1, int $pRow1, int $pColumn2, int $pRow2) : \PHPExcel_Worksheet

### Parameters

#### $pColumn1

`int`

Numeric column coordinate of the first cell

#### $pRow1

`int`

Numeric row coordinate of the first cell

#### $pColumn2

`int`

Numeric column coordinate of the last cell

#### $pRow2

`int`

Numeric row coordinate of the last cell

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Remove protection on a cell range

    unprotectCells(string $pRange) : \PHPExcel_Worksheet

### Parameters

#### $pRange

`string`

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

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Remove protection on a cell range by using numeric cell coordinates

    unprotectCellsByColumnAndRow(int $pColumn1, int $pRow1, int $pColumn2, int $pRow2, string $pPassword, boolean $pAlreadyHashed) : \PHPExcel_Worksheet

### Parameters

#### $pColumn1

`int`

Numeric column coordinate of the first cell

#### $pRow1

`int`

Numeric row coordinate of the first cell

#### $pColumn2

`int`

Numeric column coordinate of the last cell

#### $pRow2

`int`

Numeric row coordinate of the last cell

#### $pPassword

`string`

Password to unlock the protection

#### $pAlreadyHashed

`boolean`

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

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Check sheet code name for valid Excel syntax

    _checkSheetCodeName(string $pValue) : string

Static

### Parameters

#### $pValue

`string`

The string to check

### Exceptions

`\Exception` |

### Returns

`string`The valid string

## Check sheet title for valid Excel syntax

    _checkSheetTitle(string $pValue) : string

Static

### Parameters

#### $pValue

`string`

The string to check

### Exceptions

`\PHPExcel_Exception` |

### Returns

`string`The valid string

## Create a new cell at the specified coordinate

    _createNewCell(string $pCoordinate) : \PHPExcel_Cell

### Parameters

#### $pCoordinate

`string`

Coordinate of the cell

### Returns

`\PHPExcel_Cell`Cell that was created

### Properties

##

    $_activeCell : string

(Only one!)

##

    $_autoFilter : \PHPExcel_Worksheet_AutoFilter

##

    $_breaks : array

##

    $_cachedHighestColumn : string

##

    $_cachedHighestRow : int

##

    $_cellCollection : \PHPExcel_CachedObjectStorage_xxx

##

    $_cellCollectionIsSorted : boolean

##

    $_chartCollection : \PHPExcel_Chart[]

##

    $_codeName : string

##

    $_columnDimensions : \PHPExcel_Worksheet_ColumnDimension[]

##

    $_comments : \PHPExcel_Comment[]

##

    $_conditionalStylesCollection : array

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

##

    $_dataValidationCollection : array

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

##

    $_defaultColumnDimension : \PHPExcel_Worksheet_ColumnDimension

##

    $_defaultRowDimension : \PHPExcel_Worksheet_RowDimension

##

    $_dirty : boolean

##

    $_drawingCollection : \PHPExcel_Worksheet_BaseDrawing[]

##

    $_freezePane : string

##

    $_hash : string

##

    $_headerFooter : \PHPExcel_Worksheet_HeaderFooter

##

    $_hyperlinkCollection : array

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

##

    $_invalidCharacters : array

##

    $_mergeCells : array

##

    $_pageMargins : \PHPExcel_Worksheet_PageMargins

##

    $_pageSetup : \PHPExcel_Worksheet_PageSetup

##

    $_parent : \PHPExcel

##

    $_printGridlines : boolean

##

    $_protectedCells : array

##

    $_protection : \PHPExcel_Worksheet_Protection

##

    $_rightToLeft : boolean

##

    $_rowDimensions : \PHPExcel_Worksheet_RowDimension[]

##

    $_selectedCells : string

##

    $_sheetState : string

##

    $_sheetView : \PHPExcel_Worksheet_SheetView

##

    $_showGridlines : boolean

##

    $_showRowColHeaders : boolean

##

    $_showSummaryBelow : boolean

##

    $_showSummaryRight : boolean

##

    $_styles : \PHPExcel_Style[]

##

    $_tabColor : \PHPExcel_Style_Color

##

    $_title : string

### Constants

## BREAK_COLUMN

    BREAK_COLUMN

## BREAK_NONE

    BREAK_NONE

## BREAK_ROW

    BREAK_ROW

## SHEETSTATE_HIDDEN

    SHEETSTATE_HIDDEN

## SHEETSTATE_VERYHIDDEN

    SHEETSTATE_VERYHIDDEN

## SHEETSTATE_VISIBLE

    SHEETSTATE_VISIBLE