-
-
Save ndthanh/2e7f5046c4d13dcf932f44f22746e3b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createMenu() { | |
const ui = SpreadsheetApp.getUi(); | |
const menu = ui.createMenu("Customer Management System"); | |
menu.addItem("Mở userform (sidebar)", "loadCustomerForm"); | |
menu.addItem("Mở userform (Modal)", "loadCustomerFormModal"); | |
menu.addItem("Mở userform (Modeless)", "loadCustomerFormModeless"); | |
menu.addToUi(); | |
} | |
function loadCustomerForm() { | |
const html = HtmlService.createHtmlOutputFromFile("index").setTitle("dtnguyen.business"); | |
const ui = SpreadsheetApp.getUi(); | |
// ui.showModalDialog(html, "Customer Management System"); | |
// ui.showModelessDialog(html, "Customer Management System"); | |
ui.showSidebar(html); | |
} | |
function loadCustomerFormModal() { | |
const width = 640; | |
const height = 480; | |
const html = HtmlService.createHtmlOutputFromFile("index"); | |
html.setWidth(width).setHeight(height); | |
const ui = SpreadsheetApp.getUi(); | |
ui.showModalDialog(html, "Customer Management System"); | |
} | |
function loadCustomerFormModeless() { | |
const width = 640; | |
const height = 480; | |
const html = HtmlService.createHtmlOutputFromFile("index"); | |
html.setWidth(width).setHeight(height); | |
const ui = SpreadsheetApp.getUi(); | |
ui.showModelessDialog(html, "Customer Management System"); | |
} | |
function onOpen() { | |
createMenu(); | |
} | |
function dienDuLieu(data) { | |
const ws = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("data"); | |
ws.appendRow([data.id, data.firstName, data.lastName, data.email]); | |
} | |
function errMessage() { | |
Browser.msgBox("Bạn cần điền đầy đủ tất cả các trường!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Trên https://blog.hocexcel.online chỉ nói
Các bạn sẽ cần thiết lập một bảng tính Google Sheets mới gồm có 4 cột: ID, First Name, Last Name, Email.
mà không ghi rõ hơn là SheetName là data luôn.