Paste text into a specific cell - apps scrpit google sheet

Hi,

I would like to ask for help.
I have two sheets:

  • “data” and
  • “performance”.

In sheet “data” (in cell “A2”) I have a text I’m going to search for in sheet “performance”
when that text is found in “performance” - I need to paste “DONE” (paste_Value) into the cell one column left of the cell the text is found

function myFunction() {
  const sheet1 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("data");
  const sheet2 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("performance");

  var value1 = sheet1.getRange("A2").getValue();
  const tekst1 = 'DONE'

  const findString = value1;
  const textFinder = sheet2.createTextFinder(value1);

  const items = textFinder.findAll();
  const cell = textFinder.findNext();
  const wiersz = cell.getRow();
  const kolumna = cell.getColumn()-1;

please let me know how the rest of the script code should look like - that I could paste “DONE” (paste_value) into a cell I searched for in “performance”

Hi @Irek

Once you know the row and column (minus 1) where the value is found, what method can you use to get a reference to that specific cell in the performance sheet? Kindly check which method lets you get a cell using its row and column?

Also, once you have a reference to that cell (the one column left of the found match), what method allows you to set a value like "DONE" into that cell?

thanks, but could you please let me know how the code should look like ?
i’m quite fresh in case of Apps script coding - so I’m not sure where to look for the method I could use in that case

I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

1 Like

HI @Irek , I am sorry I was off for a bit. Have you being able to figure it out?