Bảo mật Google Sheets: 10 tips quan trọng bạn cần biết
10 tháng 1, 2026
Cập nhật: 18 tháng 8, 2026
14 phút đọc
Dữ liệu là tài sản quý giá. Hãy bảo vệ nó đúng cách với 10 tips sau!
1. Phân quyền truy cập đúng cách
Các cấp độ quyền:
- Viewer: Chỉ xem, không sửa
- Commenter: Xem và comment
- Editor: Toàn quyền chỉnh sửa
Best practices:
✅ Mặc định share "Viewer"
✅ Chỉ cấp "Editor" khi thực sự cần
✅ Kiểm tra định kỳ danh sách người có quyền
❌ Không share "Anyone with the link" cho dữ liệu nhạy cảm
Cách kiểm tra:
File → Share → See who has access
2. Bảo vệ Sheet và Range
Protect entire sheet:
Data → Protect sheets and ranges → Add a sheet
Protect specific range:
Data → Protect sheets and ranges → Add a range
Cho phép một số người edit:
- Chọn "Restrict who can edit this range"
- Thêm email được phép
3. Ẩn công thức quan trọng
Cách 1: Custom number format
Format → Number → Custom number format
Nhập: ;;;
Cách 2: Apps Script
function hideFormulas() {
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getRange('A1:Z100');
range.getValues().forEach((row, i) => {
row.forEach((cell, j) => {
if (typeof cell === 'string' && cell.startsWith('=')) {
// Công thức được ẩn
}
});
});
}
4. Audit logging với Apps Script
Ghi log mọi thay đổi:
function onEdit(e) {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const logSheet = ss.getSheetByName('AuditLog') || ss.insertSheet('AuditLog');
const user = Session.getActiveUser().getEmail();
const sheet = e.source.getActiveSheet().getName();
const cell = e.range.getA1Notation();
const oldValue = e.oldValue || '';
const newValue = e.value || '';
const timestamp = new Date();
logSheet.appendRow([
timestamp,
user,
sheet,
cell,
oldValue,
newValue
]);
}
Cấu trúc AuditLog:
| Timestamp | User | Sheet | Cell | Old Value | New Value |
|---|
5. Mã hóa dữ liệu nhạy cảm
Simple encryption với Apps Script:
function encrypt(text, key) {
let result = '';
for (let i = 0; i < text.length; i++) {
result += String.fromCharCode(
text.charCodeAt(i) ^ key.charCodeAt(i % key.length)
);
}
return Utilities.base64Encode(result);
}
function decrypt(encoded, key) {
const text = Utilities.base64Decode(encoded);
let result = '';
for (let i = 0; i < text.length; i++) {
result += String.fromCharCode(
text[i] ^ key.charCodeAt(i % key.length)
);
}
return result;
}
⚠️ Lưu ý: Đây chỉ là encryption cơ bản. Với dữ liệu cực kỳ nhạy cảm, nên sử dụng giải pháp chuyên nghiệp.
6. Hạn chế download và copy
Disable download, print, copy:
File → Share → Advanced → ⚙️ Settings
☐ Viewers and commenters can see the option to download, print, and copy
7. Two-Factor Authentication
Bật 2FA cho tài khoản Google:
myaccount.google.com → Security → 2-Step Verification
8. Kiểm tra Activity Dashboard
Xem ai đã xem file:
Tools → Activity dashboard
Thông tin hiển thị:
- Ai đã xem
- Khi nào xem
- Xu hướng view
9. Version History & Backup
Xem lịch sử:
File → Version history → See version history
Tạo named version:
File → Version history → Name current version
Auto backup với Apps Script:
function weeklyBackup() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const backupFolder = DriveApp.getFolderById('YOUR_FOLDER_ID');
const date = Utilities.formatDate(new Date(), 'Asia/Ho_Chi_Minh', 'yyyy-MM-dd');
const backupName = ss.getName() + '_backup_' + date;
DriveApp.getFileById(ss.getId()).makeCopy(backupName, backupFolder);
// Xóa backup cũ hơn 30 ngày
const files = backupFolder.getFiles();
const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000);
while (files.hasNext()) {
const file = files.next();
if (file.getDateCreated() < thirtyDaysAgo) {
file.setTrashed(true);
}
}
}
10. Data Loss Prevention
Ngăn xóa nhầm:
- Protect formulas (đã đề cập ở tip #2)
- Validation rules cho input
- Confirmation dialogs bằng Apps Script:
function onEdit(e) {
const dangerRange = e.source.getRange('A1:Z10'); // Vùng quan trọng
if (e.range.getSheet().getName() === 'ImportantData') {
if (dangerRange.getA1Notation().includes(e.range.getA1Notation())) {
const ui = SpreadsheetApp.getUi();
const response = ui.alert(
'⚠️ Cảnh báo',
'Bạn đang sửa vùng dữ liệu quan trọng. Tiếp tục?',
ui.ButtonSet.YES_NO
);
if (response !== ui.Button.YES) {
e.range.setValue(e.oldValue);
}
}
}
}
Checklist bảo mật
| # | Kiểm tra | Tần suất | ✅ |
|---|---|---|---|
| 1 | Review danh sách người có quyền | Hàng tháng | |
| 2 | Kiểm tra protected ranges | Hàng quý | |
| 3 | Review audit log | Hàng tuần | |
| 4 | Kiểm tra backup | Hàng tuần | |
| 5 | Cập nhật mật khẩu | 3-6 tháng | |
| 6 | Review shared links | Hàng tháng |
Kết luận
Bảo mật là quá trình liên tục, không phải việc làm một lần. Áp dụng 10 tips này và kiểm tra định kỳ để đảm bảo dữ liệu của bạn luôn an toàn!
Lưu ý: Với dữ liệu doanh nghiệp quan trọng, nên cân nhắc Google Workspace với các tính năng bảo mật nâng cao.
Xem thêm tại SheetStore
📚 Bài Viết Liên Quan
- Case Study: Môi Giới BĐS Quản Lý 100+ Khách Hàng, Tăng x3 Giao Dịch Với CRM Google Sheets
- Case Study: Nhà Thuốc 2.000+ SKU — Hàng Hết Hạn 0%, Luôn Sẵn Hàng Bán Chạy
- Case Study: Siêu Thị Mini 5.000 SKU — Kiểm Kho 1 Tiếng, Hàng Luôn Đủ Bán
- Case Study: SME 10 Nhân Viên Tiết Kiệm 40 Giờ/Tháng Nhờ Tự Động Hóa Google Apps Script
Chia sẻ bài viết:
Hoàng Mạnh Tuân
Bạn thấy bài viết hữu ích?
Đăng ký nhận thông báo khi có bài viết mới.