Giáo án link (giaoan.link) chia sẻ đến bạn một project Google sheet Apps script Password Protect Spreadsheet – Giao diện người dùng UI. Đối với project này, mỗi khi spreadsheet được mở thì một popup được bật lên yêu cầu bạn nhập pass để được thao tác tiếp. Nếu bạn điền sai, sẽ có thông báo và yêu càu bạn nhập lại cho đến khi chính xác. Bạn tham khảo code bên dưới và video hướng dẫn bên dưới.
Project excel ứng dụng khác:
- Web App Script CSS JS | Tạo hiệu ứng Click button Nổ tung các mảnh giấy và chuyển link
- Web App Script CSS | Tạo button Liên hệ gồm 3 option đẹp mắt cho trang web
- Web App Script Webapp | Hiệu ứng hoa rơi – Form nhập liệu Gửi nội dung đến email
- Web App Script | Thanh trạng thái Status bar – Giá trị thể hiện theo điểm và label.
- Google sheet Apps script | Data Entry Form – Tự động đọc số tiền thành chữ ở trường input
- Google sheet Apps script | Cập nhật điểm lớp học – Theo danh sách lớp và Theo từng học sinh
- Google sheet, apps script Định dạng dấu phân cách hàng ngàn cho input
- Google sheet apps script | Chọn năm và kiểu biểu đồ để Load dữ liệu lên website
- Google sheet apps script | Scan QR code – Filter and get data table display on webapp
- Google sheet apps script Filter to get data to display on webapp, fill background color for data row
Code apps script tham khảo:
function passwordSheet() {
//ss = SpreadsheetApp.getActiveSpreadsheet()
let password = '12345'
let codeCheck =''
let ui = SpreadsheetApp.getUi()
let bt = ui.Button.CANCEL
let msgBox = ui.prompt('Vui lòng nhập mật khẩu', ui.ButtonSet.OK)
let button = msgBox.getSelectedButton()
input = msgBox.getResponseText()
if(button == ui.Button.OK && input == password){
ui.alert('Mật khẩu đúng!')
}else{
while(codeCheck != password || bt != ui.Button.OK){
let form = ui.prompt('Sai Mật khẩu. Vui lòng nhập lại!', ui.ButtonSet.OK)
codeCheck = form.getResponseText()
bt = form.getSelectedButton()
}
ui.alert('Mật khẩu đúng!')
}
}