copy and paste text into specific cell

50 views
Skip to first unread message

Irek Wesolowski

unread,
Apr 19, 2025, 2:24:12 AMApr 19
to Google Apps Script Community

Hi,

I would like to ask for help.

I have two sheets:
- "data" and
- "performance".
In sheet "data" (in "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"

Keith Andersen

unread,
Apr 21, 2025, 11:34:01 PMApr 21
to google-apps-sc...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-script-community/74a7570a-f0e0-440c-b976-b352c5de2f00n%40googlegroups.com.


--

Passions: God, Family, Friends, Scripture, Data Management, Google Sheets + App Script, MS Access, Programing, sharing and much more.

Keith Andersen

unread,
Apr 21, 2025, 11:48:50 PMApr 21
to google-apps-sc...@googlegroups.com
*IMPROVED

Added:
 Case sensitive matching
 Match entire cell content only
 Don't search in formula text

Keith Andersen

unread,
Apr 25, 2025, 8:33:19 PMApr 25
to google-apps-sc...@googlegroups.com

Were you able to implement this?



My website: https://sites.google.com/view/klaweb/
Passions: God, Family, Scriptures, Learning, Data Management, Google Sheets + App Script and much more!
Reply all
Reply to author
Forward
0 new messages