- You want to retrieve
the date and time from the URLs like https://www.punters.com.au/form-guide/doomben_171972/millers-swim-school-maiden-plate_987944/ and https://www.punters.com.au/form-guide/doomben_171972/paddyfest-march-14-qtis-three-years-old-maiden-plate_987945/.
- The HTML structure is constant for each URL.
- You want to achieve this using Google Apps Script.
If my understanding is correct, how about this answer? Please think of this as just one of several possible answers.
Unfortunately, the values like Thursday, 13 Feb at 4:57pm cannot be directly retrieved. So at first, the unix time is retrieved and the value is converted to the string with the format.
Sample script:
Before you run the script, please set the sheet name. And this script supposes that the URLs are put in the column "B".
function myFunction() {
var sheetName = "Sheet1"; // Please set the sheet name.
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName(sheetName);
var urls = sheet.getRange(1, 2, sheet.getLastRow(), 1).getValues();
var requests = urls.map(([url]) => ({url: url}));
var res = UrlFetchApp.fetchAll(requests);
var timezone = ss.getSpreadsheetTimeZone();
var dateTimes = res.map(e => {
if (e.getResponseCode() == 200) {
var r = /<abbr class\="form-header__timestamp timestamp time12" data-utime\="(\d.+)"/.exec(e.getContentText())[1];
return [Utilities.formatDate(new Date(Number(r) * 1000), timezone, "EEEE, dd MMM 'at' hh:mm") + Utilities.formatDate(new Date(Number(r) * 1000), timezone, "a").toLowerCase()];
}
return [""];
});
sheet.getRange(1, 3, dateTimes.length, 1).setValues(dateTimes);
}
Result:
When you run the script, the retrieved date values are put to the column "C" as follows.

Note:
- If
fetchAll cannot be used in your situation, I think that it is required to use fetch in the loop.
References:
one importxml formula per url, can you provide the sample Spreadsheet including the sample URLs? Because if the HTML structure is different for each URL, the script is required to be modified for each URL. I worry about this.