I'm Trying to create a function in which data is transferred from one sheet to another sheet according to the condition matching in Two Cells. 1st condition is the Status "Shifted" located in 7th Column & 2nd condition is "name"(Name of the sheet or person) in which the data has to be transferred in.
The Issue : The sheet in which I'm transferring the data in has some hidden formulas like timestamp & If formula, because of these the code "getLastRow" is reading the whole sheet as reference for pasting the data and it's getting pasted in the very last row & it's just after the row where the last hidden formula is written. Example : Row 500.
I have tried a different approach as well, where I tried to add timestamp in app script rather then the main sheet as formula but I'm unable to do so because two "onEdit(event)" are not working together in the same spreadsheet.
That's why I want to know if there's a way to apply two "onEdit(event)" in a single app script sheet or if there is a way to make the code "getLastRow" take only a single column as it's data reference of next sheet. in this way the data will be pasted on the last blank row of the column in which we want the data to be pasted.
I Have given the code Below, please guide me in this issue if possible.
**Code**
**function onEdit(event) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();
var prev_activerange =SpreadsheetApp.getActiveSheet().getRange(r.getRow() ,7).getValue();
if(r.getColumn() == 8)
if(s.getName() == "Data" && r.getColumn() == 8 && r.getValue() == "Data2" && prev_activerange=="Shifted")
{
var row = r.getRow();
var numColumns = s.getLastColumn() - 5;
var targetSheet = ss.getSheetByName("Data2");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).copyTo(target);**