'Want to put timestamp automatically with my script [onEdit is not working in this case]

I was just wondering is there any way to put timestamp (Means data added date&time) automatically in a specific column (col'N') with the help of Apps Script. My script collect data from a spreadsheet to my spreadsheet in an append way so I want to put a timestamp in column 'N'once the script is executed.

My code:

function Copydata() {
  var opensheet = SpreadsheetApp.openById(" ");
  var getsheetname = opensheet.getSheetByName('Franchise DC Live Delivery Updation');
  var storedata = getsheetname.getRange("Franchise DC Live Delivery Updation!2:"+ getsheetname.getLastRow()).getValues();
  
  var opendheetMain =SpreadsheetApp.openById("  ");
  var getsheetnameMain = opendheetMain.getSheetByName('Live_Data');
  storedata =storedata.filter(e=>e[0]);
  getsheetnameMain.getRange(getsheetnameMain.getLastRow()+1,1,storedata.length,storedata[0].length).setValues(storedata);


}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source