📝 Bước 1: Bật Drive Advanced Service
Trong Apps Script:
- Vào Services (bên trái màn hình).
- Tìm Drive API → Nhấn Add.
Trong Google Cloud Console:
- Truy cập: Google Cloud Console
- Đảm bảo Google Drive API đã được Enable.
📝 Bước 2: Code mới sử dụng Advanced Drive API (v3)
📝 Giải thích mã:
viewersCanCopyContent: false:- Chặn người xem tải xuống, in và sao chép.
copyRequiresWriterPermission: true:- Chỉ cho phép người chỉnh sửa sao chép file.
🚀 Hướng dẫn chạy:
- Vào Apps Script → Dán code trên.
- Thay
FOLDER_IDbằng ID thư mục. - Chạy hàm
restrictDownloadInFolder. - Cho phép quyền truy cập khi được yêu cầu.
🛡️ Lưu ý:
Người Viewer sẽ không thể:
✅ Tải xuống
✅ In file
✅ Sao chép nội dungNgười Editor hoặc Owner vẫn có thể tải (nếu muốn chặn, cần hạ quyền xuống Viewer).
0 Comments