Je suis en train de faire un test, mais curieusement il ne veut pas afficher la date à l'ouverture ...
function onOpen(){
fileId="1HQ3SQCnqeZS-Ctj_qWRJdvVozLDwU4CuG1CptH5bCGs";//ID du fichier
var lastUpdated = DriveApp.getFileById(fileId).getLastUpdated();
Browser.msgBox(lastUpdated)
}
alors que ceci fonctionne bien
function dernModif() {
fileId="1HQ3SQCnqeZS-Ctj_qWRJdvVozLDwU4CuG1CptH5bCGs";//ID du fichier
var lastUpdated = DriveApp.getFileById(fileId).getLastUpdated();
Browser.msgBox(lastUpdated);
}
du coup, pour le moment, j'en suis là (avant que tu ne répondes ce matin)
function onEdit(event){
var f = event.source.getActiveSheet();
var h = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('historique')
if (f.getName() != 'historique'){
var d = new Date();
if(Math.floor(d/1000/60/24/24) != Math.floor(h.getRange('A2').getValue()/1000/60/24/24)){
h.insertRowBefore(2);
h.getRange('A2').setValue(d);
}
}
}
function onOpen(){
var h = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('historique')
toast(Utilities.formatDate(h.getRange('A2').getValue(), "GMT+2", "EEEE dd/MM/yyyy"),'dernière modification')
}
function toast(body, title, timeout) {
return SpreadsheetApp.getActive().toast(
body,
title || "information",
timeout || 5
);
}
https://docs.google.com/spreadsheets/d/1HQ3SQCnqeZS-Ctj_qWRJdvVozLDwU4CuG1CptH5bCGs/copy
Dans mon cas, la fonction personnalisée ne modifie pas la date puisqu'elle est donnée lors d'un événement onEdit (donc intervention manuelle), j'étais parti de cette idée.