I disabled the "make a copy" menu item and allow it only by a script.
function makeACopy() {
clearRange("A1:A100");
var documentId = DriveApp.getFileById('FileId').makeCopy().getId();
DriveApp.getFileById(documentId).setName('PT generator' + new Date() );
};
function clearRange(rangeToClear) {
const sheet = SpreadsheetApp.getActive().getSheetByName('Sheet1');
const formulas = sheet.getRange(rangeToClear).getFormulas();
sheet.getRange(rangeToClear).clear({
contentsOnly: true,
skipFilteredRows: false
});
sheet.getRange(rangeToClear).setFormulas(formulas)
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.