I have been trying to find an example of this for a while with no luck.
I have two sheets 'Inventory' and 'Sold'. I enter my 'Sold' item in Cell A2 of the Sold sheet, then enter more info about it (who sold to and how much, etc.) at that point I want to automate taking the item from the 'Inventory' sheet by simply making it blank in the inventory sheet (it is just a single cell on the inventory sheet).
I have been able to use textFinder when looking up specific text and then change it to " ", so wondering if there is a way to change this code to look up the specific text in cell 'A2' on the 'Sold' sheet since the text in A2 will change each time I sell a different item.
Here is the snip I would use if A2 was always 'Blanket Red':
function searchAndReplace(searchTerm, replacement) {
let textFinder = SpreadsheetApp.getActive().getSheetByName("Inventory").createTextFinder("Blanket Red").replaceAllWith("");
}
I have tried various was to get the value in A2 and it does not seem to work in the createtextFinder.
I don't have a ton of data, so I thought this would be a simple way to find and replace the value but cannot figure out how to insert the text from 'A2' instead of search for a constant text string. Is there a way to do this?
Thanks in advance.
- J