I've done a lengthy search and couldn't find what I'm looking for. Maybe someone out there can kindly help?
I have two Google Spreadsheets, Spread1 and Spread2. I will only be referring to sheet1 of both spreadsheets.
I need a script that deletes rows containing "Hello" in column B of Spread1 but only if "Hello" appears in column B of Spread2.
If rows are deleted (if the same word appears in both columns), then I would like the script to go back to Spread2 and also delete the rows with "Hello" in column B.
So after the script has run, "Hello" will not appear in column B in either of the spreadsheets.
If anyone knows how to achieve this I will be very grateful indeed - your valuable help will be much appreciated.
Thanks for looking!
EDIT:
I have this script which deletes rows in Spread2 that contain "hello" in column B:
function deleteRow() {
var ss = SpreadsheetApp.openById("SPREADSHEET KEY");
SpreadsheetApp.setActiveSpreadsheet(ss);
var s = ss.getSheetByName('Sheet1'); // change to your own
var values = s.getDataRange().getValues();
for( var row = values.length -1; row >= 0; --row )
if (values[row][1] == 'Hello')
s.deleteRow(parseInt(row)+1);
};
but I only want it to do so when "Hello" appears in column B of Spread1. Any ideas? Thanks