super!!! ça marche!
un grand grand merci!
vue que j'ai trois onglets, faut il que je fasse un script par onglet, ou il s'applique automatiquement à tout les onglets?
dit moi vue que tu t'y connais très très bien en script, saurait tu m'expliquer comment utiliser ce script pour mon fichier?
function verifStock() {
var html = '<p>Bonjour,<br><br>Les produits suivants arrivent à leur stock minimal :</p><br>';
html += '<style>td,th{border:1px solid #000;}</style><table>';
var donnees = SpreadsheetApp.getActiveSheet().getSheetValues(1, 1, -1, 3).filter ( function (rang) {
return rang[2] < rang[1];
}).map ( function (d, i) {
html += '<tr>';
return html += i === 0 ? '<th>' + d[0] + '</th>' + '<th>' + d[1] + '</th>' + '<th>' + d[2] + '</th>' :
'<td>' + d[0] + '</td>' + '<td>' + d[1] + '</td>' + '<td>' + d[2] + '</td>';
});
html += '<table>'
if(donnees[0].length > 1) {
MailApp.sendEmail({
to: 'jb_fino@live.fr',
subject: 'Stock mini atteint',
htmlBody: html
});
}
}
function onOpen() {
SpreadsheetApp.getUi().createMenu("Stock")
.addItem("Stock en dessous de l'objectif", "verifStock")
.addToUi();
}
j'ai trouvé ça sur internet, mais je ne comprends pas où sont indiquées les colonnes des stocks mini et stock réels...