I am running into an issue with getValue and the format it gives back in Google Sheets. The value in the cell is 2/19/2019 in format M/dd/yyyy in sheets but it is giving back =Tue Feb 19 2019 00:00:00 GMT-0600 (CST) (picture attached of issue). I am curious on how I can get the cell I am trying to fill to be the same format and look the same as 2/19/2019. Here is my code I am currently working on:
function fillDown() {
var ss = SpreadsheetApp.openById('spreadsheetId');
var sheet = ss.getSheetByName("spreadsheetName");
var originRange = sheet.getRange(sheet.getLastRow(), 1);
var targetRange = sheet.getRange(sheet.getLastRow()+1, 1)
var formula = originRange.getValue();
targetRange.activate();
sheet.getCurrentCell().setFormula(formula);
}