Find and replace Version 1 (Python)

Action group: Office


Description

The action finds and replaces a value in the document

Action icon

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
ContextAction context for working with ods/xlsx table.Robin.OpenSheetD oc
Yes
FindThe value to be found.Robin.String
Yes
Replace withThe value by which the searched text will be replaced. If the field is not filled in, the searched text will be cut out of the cell.Robin.String
No
Replacement modeText replacement mode. The default value is «Replace first match»Robin.String
No
Account registerIf «true», the case of the letters of the searched value will be taken into account.Robin.BooleantrueNo
Search methodThe rule that will be used to compare the value from the cell with the searched text when searching for a matching cell or cells. The default value is «Full match to text».Robin.String
No
Results
ResultDictionary with modified cells, where key is the cell address, value is the modified cell value.Robin.Dictionary

Special conditions of use

None.

Example of use

Task

There is a table with numbers, you need to replace the values 3 with 11.

Solution

Use the actions "Open", "Find and replace", "Save".

Implementation

  1. Assemble a robot scheme consisting of actions:


2. Set the "Path to file" parameter for the "Open" action. In the "Context" parameter specify the context of the opened tabular document "Test 1".

3. Set the parameters for the "Find and replace" action. 

    • In the "Context" parameter specify the context of the opened tabular document "Test 1".
    • In the "Find" parameter specify the value to be searched for in the document. 
    • In the "Replace with" parameter specify the value, by which the found matches will be replaced.
    • In the "Replacement mode" parameter select "Replace all matches" to replace all matches found in the document.
    • In the "Search method" parameter select "Full match with text". Thus, only those matches that match completely will be replaced.

4. Set parameters for the "Save" action. In the "Context" parameter specify the context of the opened tabular document "Test 1".

5. Launch the robot using the "Start" button in the top panel.

Result

The program robot completed successfully.


Values have been replaced.

  • Нет меток