当导入数据发生变化时,接种通知。没有人会编辑这个。 用电子邮件与永久的Excel表Atthart
在电子邮件结束时,影响的行总数= +-4
function sendNotification() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var cell = ss.getActiveCell().getA1Notation();
var row = sheet.getActiveRange().getRow();
var cellvalue = ss.getActiveCell().getValue().toString();
var to = "[email protected]";
var message = '\n\nSignature';
if(cell.indexOf('G')!=-1){
message = sheet.getRange('D'+ sheet.getActiveCell().getRowIndex()).getValue()
}
var subject = 'Data Updated';
var body = 'Hi there,\n\nThe data on website was updated recently.\n\nKindly refresh the previous excel sheet or click ' + 'https://docs.google.com/spreadsheets/d/1BTdA7Rx16W6la_gri4uP079yIzzgKfZKO610yfQ6724/edit#gid=0' + ' to see changes.\n\n\nThe changes are:\nTotal Rows affected: ' + row + '\n' + message;
MailApp.sendEmail(to, subject, body);
};
function onEdit() {
var getProps = PropertiesService.getUserProperties();
var lenProp = getProps.getProperty('Len');
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('-------');
var data = sheet.getRange('A1:A').getValues().toString().length;
if (data != lenProp) {
getProps.setProperty('Len', data);
MailApp.sendEmail('-------------', 'Sheet Has Changed', 'Previous value: ' + lenProp + ' New value: ' + data);
}
}
我在跟踪我的共享/在线excel文件中的更改上进行了各种解决方法,我最终为此创建了一个应用程序:
https://trackchanges.app/可以跟踪共享/在线excel或Google电子表格的更改,您可以通过chance