Allied website page
Step Deploy (Publication)
1.Go to the "Deploy" menu: In the Apps Script Editor, click on the "Deploy" button (top right), then select "Reworking" or "New Deployment."
2. Select Deploy Type: Select "Web App" or "Web app" type.
3.Schedule settings:
❇ Description: Insert a short description (e.g. version 1)
❇ Execute as: Choose "I" or "Me" to make the code run as yourself.
❇ Who has access: Select "Everyone" or "Anyone" so that others can access your pages (if you want only people in the organization to access it, select "Everyone with a Google account" or "Anyone with a Google account"
4. Deploy: Click on the "Deploy" button
5.Copy URL: Once the Deploy is successful, you will receive a Web App URL that can be used immediately.
Additional steps: revisions and updates
• If you have a code modification and want the changes to be displayed on the page, you will need to make a new Deploy.
• In the Deploy menu, select "Manage Making Use" or "Manage Clearances" and click on the pen icon to edit the current version or create a new version.
• Select the new version you want to publish and click "Deploy."
Following these steps will allow you to completely create and publish web applications on Google Apps Script.
Note...But while editing the file to see the web page for testing, go to the blue bar menu on the top right. Again, click the Make it work button. Select "Testing implementation will get the URL file extension dev. Then double click the URL to get the web site. Example URL
""
พอทำ Google Apps Script เสร็จ หลายคนจะติดตรง “Deploy แล้วเอา URL ไหนไปใช้?” หรือแก้โค้ดแล้วทำไมหน้าเว็บไม่อัปเดต ฉันขอแชร์ทริคที่ใช้ประจำเวลา deploy apps script เป็น Web app ให้ใช้งานได้จริง พร้อมแยกความต่างของ deployment url แบบ dev/exec แบบเข้าใจง่าย 1) เข้าใจ URL สองแบบ: dev vs exec - URL ลงท้าย /dev = ใช้สำหรับ “การนำการทดสอบใช้งาน” (ทดสอบเร็ว ๆ) เหมาะกับตอนกำลังแก้หน้าเว็บบ่อย ๆ แต่บางครั้งคนอื่นเข้าไม่ได้ ขึ้นกับสิทธิ์ที่ตั้งไว้ - URL ลงท้าย /exec = URL สำหรับ “ใช้งานจริง” หลัง Deploy แล้วเอาไปแปะให้คนเปิดได้ทั่วไป (ตามสิทธิ์ที่ตั้ง) ถ้าต้องส่งให้คนใช้งานจริง แนะนำให้ใช้ /exec เป็นหลัก 2) เช็กลำดับการ Deploy ให้ครบ (กันพลาดเรื่องสิทธิ์) เวลาไปที่ Deploy → New deployment → Web app ฉันจะเช็ก 3 จุดนี้ทุกครั้ง - Description: ใส่ชื่อเวอร์ชัน เช่น v1, v1.1 (ช่วยให้ตามรอยง่าย) - Execute as: ส่วนใหญ่เลือก “Me” เพื่อให้สคริปต์รันด้วยสิทธิ์เจ้าของ - Who has access: ถ้าจะให้คนทั่วไปเปิดได้ เลือก “Anyone” (หรืออย่างน้อย “Anyone with a Google account”) จากนั้นกด Deploy แล้วคัดลอก URL เก็บไว้ 3) อัปเดตแล้วไม่เปลี่ยน: ต้อง Deploy ใหม่หรือเลือกเวอร์ชันใหม่ ข้อที่ทำให้หลายคนงงคือ แก้โค้ดในไฟล์แล้ว URL เดิมยังเป็นหน้าเก่า วิธีที่ฉันใช้คือ - ไปที่ Deploy → Manage deployments - กดไอคอนดินสอ (Edit) แล้วเลือก “New version” หรือสร้าง deployment ใหม่ - กด Deploy อีกครั้ง แล้วทดสอบด้วย URL /exec ถ้าคุณใช้ URL /dev เพื่อเทสต์ ก็เข้าเมนู “การนำการทดสอบใช้งาน” แล้วเปิดลิงก์ dev ดูว่าตรงกับโค้ดล่าสุดไหม 4) จุดสำคัญในโค้ดเว็บแอป: doGet ต้องมี เว็บแอปส่วนมากต้องมีฟังก์ชัน doGet เพื่อคืนค่า HTML เช่น - doGet(){ return HtmlService.createTemplateFromFile(...).evaluate(); } ถ้า deploy แล้วเจอหน้าขาว/เออเรอร์ ฉันจะเริ่มเช็กที่ doGet ก่อนว่าเรียกไฟล์ถูกไหม และมี return ของ HtmlService จริงหรือเปล่า 5) ทริคทดสอบเร็ว: เปิด dev ก่อน แล้วค่อยปล่อย exec ฉันมักทำแบบนี้: - แก้โค้ด → เปิดลิงก์ /dev เพื่อดูผลเร็ว ๆ - พอทุกอย่างโอเค → Deploy เวอร์ชันใหม่ → ใช้ /exec ส่งให้ผู้ใช้ ช่วยลดปัญหาส่งลิงก์แล้วเจอบั๊ก สรุปคือ ถ้าต้องการ deployment url สำหรับใช้งานจริงให้โฟกัสที่ /exec และทุกครั้งที่แก้โค้ดอย่าลืม Deploy (หรือสร้าง New version) ไม่งั้นหน้าเว็บจะไม่อัปเดตตามที่เราคิดไว้





























































































