I am trying to figure out how to convert a date into a string in a google sheet.
I have one date field that has varying formats. I want create another column that\'s lit
I don't understand why you need this. Just figured out that there's no way to detect the format of dates in google sheets. But you may use getDisplayValues property. Paste this code into script editor:
function repeatAsText(A1Notation, sheet) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
if (sheet) { sheet = ss.getSheetByName(sheet); }
else { sheet = ss.getActiveSheet(); }
var range = sheet.getRange(A1Notation);
return range.getDisplayValues();
}
and then use it as ususl formula:
=repeatAsText("A1:A3")
A1Notation -- string like "A1" or "B3:AD15".
sheet -- name of sheet, like "Sheet1". It is optional, use ActiveSheet if omitted