searchAndReplace
searchAndReplace
ADVANCED / PREMIUM
BASIC
Searches and replaces shared strings and cell values in an Excel spreadsheet.
Description
public searchAndReplace($source, $target, $data, $scope, $options = array())
This method allows the substitution of plain strings and cell values in an XLSX spreadsheet.
Parameters
source
The path to the source XLSX file.
target
The path to the XLSX file resulting after the text replacement.
data
The data to be replaced. Plain strings or an array with the following keys: row (row number), col (column number to replace, 1 as first position) and value (value to add).
scope
sharedStrings (text strings) or sheet (cell values).
options
The possible keys and values are:
Key | Type | Description |
---|---|---|
sheetName | string | Sheet name to replace the value when using sheet as scope. All if null. |
sheetNumber | int | Sheet number to replace the value when using sheet as scope. All if null. |
Code samples
Example #1
Example #2
Release notes
- phpxlsx 1.0:
- new method.