Skip to content

Instantly share code, notes, and snippets.

@ndthanh

ndthanh/code.gs Secret

Created Aug 23, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.