{"id":7424,"date":"2025-03-19T12:00:00","date_gmt":"2025-03-19T06:30:00","guid":{"rendered":"https:\/\/www.notiontechnologies.com\/blog\/?p=7424"},"modified":"2025-03-19T13:46:03","modified_gmt":"2025-03-19T08:16:03","slug":"how-to-create-a-password-protected-google-site-with-apps-script","status":"publish","type":"post","link":"https:\/\/www.notiontechnologies.com\/blog\/how-to-create-a-password-protected-google-site-with-apps-script\/","title":{"rendered":"How to Create a Password-Protected Google Site with Apps Script"},"content":{"rendered":"\n<p>Creating a password-protected Google Site is a great way to secure your content. With <strong>Google Apps Script<\/strong>, you can easily add a password layer to your site. This guide will walk you through the process step by step. Let\u2019s get started!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Password Protect a Google Site?<\/h2>\n\n\n\n<p>Google Sites is a free tool to create websites. But it lacks built-in password protection. If you want to restrict access, <strong>Google Apps Script<\/strong> is the solution. It allows you to add custom functionality, like a password system.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to Create a Password-Protected Google Site<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Create a Google Site<\/h3>\n\n\n\n<p>First, create your Google Site. Go to <a href=\"https:\/\/sites.google.com\">Google Sites<\/a> and click \u201cCreate.\u201d Design your site as needed. Add pages, text, images, and other content.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Open Google Apps Script<\/h3>\n\n\n\n<p>Once your site is ready, open <strong>Google Apps Script<\/strong>. Go to <a href=\"https:\/\/script.google.com\">Google Apps Script<\/a> and start a new project. This is where you\u2019ll write the code for password protection.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Write the Password Protection Code<\/h3>\n\n\n\n<p>In the Apps Script editor, write the following code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function doGet(e) {\n  var password = e.parameter.password;\n  var correctPassword = \"YourPassword123\"; \/\/ Change this to your desired password\n\n  if (password === correctPassword) {\n    return HtmlService.createHtmlOutputFromFile('Welcome');\n  } else {\n    return HtmlService.createHtmlOutputFromFile('Login');\n  }\n}<\/code><\/pre>\n\n\n\n<p>This code checks if the entered password matches the correct password. If it does, the user sees the \u201cWelcome\u201d page. If not, they see the \u201cLogin\u201d page.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Create HTML Files<\/h3>\n\n\n\n<p>Next, create two HTML files in Apps Script:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Login.html<\/strong>: This file will contain the password form.<\/li>\n\n\n\n<li><strong>Welcome.html<\/strong>: This file will show the protected content.<\/li>\n<\/ul>\n\n\n\n<p>Here\u2019s an example of <strong>Login.html<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;body&gt;\n    &lt;h2&gt;Enter Password&lt;\/h2&gt;\n    &lt;form&gt;\n      &lt;input type=\"password\" name=\"password\" placeholder=\"Password\" required&gt;\n      &lt;button type=\"submit\"&gt;Submit&lt;\/button&gt;\n    &lt;\/form&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<p>And for <strong>Welcome.html<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;body&gt;\n    &lt;h2&gt;Welcome!&lt;\/h2&gt;\n    &lt;p&gt;You have successfully accessed the protected content.&lt;\/p&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Deploy the Script as a Web App<\/h3>\n\n\n\n<p>After writing the code, deploy the script as a web app. Click \u201cDeploy\u201d &gt; \u201cNew deployment.\u201d Select \u201cWeb app\u201d and set the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Execute as<\/strong>: Me<\/li>\n\n\n\n<li><strong>Who has access<\/strong>: Anyone<\/li>\n<\/ul>\n\n\n\n<p>Click \u201cDeploy\u201d and copy the web app URL.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">6. Embed the Web App in Your Google Site<\/h3>\n\n\n\n<p>Go back to your Google Site. Add an \u201cEmbed\u201d element to your page. Paste the web app URL into the embed box. This will display the password form on your site.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">7. Test Your Password Protection<\/h3>\n\n\n\n<p>Open your Google Site and test the password protection. Enter the correct password to access the protected content. If the password is wrong, the login form will reappear.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Tips for Better Security<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Use a Strong Password<\/strong>: Choose a complex password with letters, numbers, and symbols.<\/li>\n\n\n\n<li><strong>Change the Password Regularly<\/strong>: Update your password periodically to enhance security.<\/li>\n\n\n\n<li><strong>Limit Access<\/strong>: Share the password only with trusted users.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Benefits of Using Google Apps Script for Password Protection<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Customizable<\/strong>: You can modify the script to fit your needs.<\/li>\n\n\n\n<li><strong>Free<\/strong>: Google Apps Script is free to use.<\/li>\n\n\n\n<li><strong>Easy to Implement<\/strong>: No advanced coding skills are required.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Common Issues and Fixes<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Password Not Working<\/strong>: Double-check the password in the script and ensure it matches.<\/li>\n\n\n\n<li><strong>Embed Not Displaying<\/strong>: Make sure the web app URL is correctly embedded in your Google Site.<\/li>\n\n\n\n<li><strong>Access Denied<\/strong>: Ensure the web app is set to \u201cAnyone\u201d access.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Creating a password-protected Google Site with <strong>Google Apps Script<\/strong> is simple and effective. Follow the steps above to secure your site. Use a strong password and test the system thoroughly. This method is perfect for protecting sensitive information or restricting access to specific users.<\/p>\n\n\n\n<p>By using <strong>Google Apps Script<\/strong>, you can add custom features to your Google Site. It\u2019s a powerful tool for enhancing functionality and security. Start building your password-protected site today!<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Important Notes:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Always keep your password secure.<\/li>\n\n\n\n<li>Regularly update your script and test for errors.<\/li>\n\n\n\n<li>Use this method for small-scale projects. For larger sites, consider professional tools.<\/li>\n<\/ul>\n\n\n\n<p>By following this guide, you can create a <strong>password-protected Google Site<\/strong> with ease. Happy coding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Creating a password-protected Google Site is a great way to secure your content. With Google Apps Script, you can easily add a password layer to your site. This guide will&hellip;<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[],"class_list":["post-7424","post","type-post","status-publish","format-standard","hentry","category-resources"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.8 (Yoast SEO v24.3) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Create a Password-Protected Google Site with Apps Script<\/title>\n<meta name=\"description\" content=\"How to create a password-protected Google Site using Google Apps Script. Follow steps to secure your site with ease. Perfect for beginners!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.notiontechnologies.com\/blog\/how-to-create-a-password-protected-google-site-with-apps-script\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create a Password-Protected Google Site with Apps Script\" \/>\n<meta property=\"og:description\" content=\"Learn how to create a password-protected Google Site using Google Apps Script. Follow simple steps to secure your site with ease. Perfect for beginners!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.notiontechnologies.com\/blog\/how-to-create-a-password-protected-google-site-with-apps-script\/\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/NotionTechnologies\" \/>\n<meta property=\"article:published_time\" content=\"2025-03-19T06:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-19T08:16:03+00:00\" \/>\n<meta name=\"author\" content=\"Caroline Murphy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How to Create a Password-Protected Google Site with Apps Script\" \/>\n<meta name=\"twitter:description\" content=\"Learn how to create a password-protected Google Site using Google Apps Script. Follow simple steps to secure your site with ease. Perfect for beginners!\" \/>\n<meta name=\"twitter:creator\" content=\"@notiontech\" \/>\n<meta name=\"twitter:site\" content=\"@notiontech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Caroline Murphy\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Create a Password-Protected Google Site with Apps Script","description":"How to create a password-protected Google Site using Google Apps Script. Follow steps to secure your site with ease. Perfect for beginners!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.notiontechnologies.com\/blog\/how-to-create-a-password-protected-google-site-with-apps-script\/","og_locale":"en_US","og_type":"article","og_title":"How to Create a Password-Protected Google Site with Apps Script","og_description":"Learn how to create a password-protected Google Site using Google Apps Script. Follow simple steps to secure your site with ease. Perfect for beginners!","og_url":"https:\/\/www.notiontechnologies.com\/blog\/how-to-create-a-password-protected-google-site-with-apps-script\/","article_publisher":"https:\/\/www.facebook.com\/NotionTechnologies","article_published_time":"2025-03-19T06:30:00+00:00","article_modified_time":"2025-03-19T08:16:03+00:00","author":"Caroline Murphy","twitter_card":"summary_large_image","twitter_title":"How to Create a Password-Protected Google Site with Apps Script","twitter_description":"Learn how to create a password-protected Google Site using Google Apps Script. Follow simple steps to secure your site with ease. Perfect for beginners!","twitter_creator":"@notiontech","twitter_site":"@notiontech","twitter_misc":{"Written by":"Caroline Murphy","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/www.notiontechnologies.com\/blog\/how-to-create-a-password-protected-google-site-with-apps-script\/#article","isPartOf":{"@id":"https:\/\/www.notiontechnologies.com\/blog\/how-to-create-a-password-protected-google-site-with-apps-script\/"},"author":{"name":"Caroline Murphy","@id":"https:\/\/www.notiontechnologies.com\/blog\/#\/schema\/person\/e3e03eb273f61161a2d803ecf8d50be7"},"headline":"How to Create a Password-Protected Google Site with Apps Script","datePublished":"2025-03-19T06:30:00+00:00","dateModified":"2025-03-19T08:16:03+00:00","mainEntityOfPage":{"@id":"https:\/\/www.notiontechnologies.com\/blog\/how-to-create-a-password-protected-google-site-with-apps-script\/"},"wordCount":596,"publisher":{"@id":"https:\/\/www.notiontechnologies.com\/blog\/#organization"},"articleSection":["Resources"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.notiontechnologies.com\/blog\/how-to-create-a-password-protected-google-site-with-apps-script\/","url":"https:\/\/www.notiontechnologies.com\/blog\/how-to-create-a-password-protected-google-site-with-apps-script\/","name":"How to Create a Password-Protected Google Site with Apps Script","isPartOf":{"@id":"https:\/\/www.notiontechnologies.com\/blog\/#website"},"datePublished":"2025-03-19T06:30:00+00:00","dateModified":"2025-03-19T08:16:03+00:00","description":"How to create a password-protected Google Site using Google Apps Script. Follow steps to secure your site with ease. Perfect for beginners!","breadcrumb":{"@id":"https:\/\/www.notiontechnologies.com\/blog\/how-to-create-a-password-protected-google-site-with-apps-script\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.notiontechnologies.com\/blog\/how-to-create-a-password-protected-google-site-with-apps-script\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.notiontechnologies.com\/blog\/how-to-create-a-password-protected-google-site-with-apps-script\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.notiontechnologies.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Create a Password-Protected Google Site with Apps Script"}]},{"@type":"WebSite","@id":"https:\/\/www.notiontechnologies.com\/blog\/#website","url":"https:\/\/www.notiontechnologies.com\/blog\/","name":"notiontechnologies.com","description":"","publisher":{"@id":"https:\/\/www.notiontechnologies.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.notiontechnologies.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.notiontechnologies.com\/blog\/#organization","name":"Notion Technologies","url":"https:\/\/www.notiontechnologies.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.notiontechnologies.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.notiontechnologies.com\/blog\/wp-content\/uploads\/2023\/05\/notion-technologies.png","contentUrl":"https:\/\/www.notiontechnologies.com\/blog\/wp-content\/uploads\/2023\/05\/notion-technologies.png","width":336,"height":156,"caption":"Notion Technologies"},"image":{"@id":"https:\/\/www.notiontechnologies.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/NotionTechnologies","https:\/\/x.com\/notiontech","https:\/\/www.linkedin.com\/company\/notiontechnologies","https:\/\/twitter.com\/notiontech"]},{"@type":"Person","@id":"https:\/\/www.notiontechnologies.com\/blog\/#\/schema\/person\/e3e03eb273f61161a2d803ecf8d50be7","name":"Caroline Murphy","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.notiontechnologies.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ce57f0ceee12fcdf8b2015d2d3b9e4c2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ce57f0ceee12fcdf8b2015d2d3b9e4c2?s=96&d=mm&r=g","caption":"Caroline Murphy"},"description":"Staff Writer. Frequently covers tech, business psychology, social media, startups and digital marketing.","sameAs":["https:\/\/www.notiontechnologies.com"],"url":"https:\/\/www.notiontechnologies.com\/blog\/author\/caroline-murphy\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.notiontechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/7424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.notiontechnologies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.notiontechnologies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.notiontechnologies.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.notiontechnologies.com\/blog\/wp-json\/wp\/v2\/comments?post=7424"}],"version-history":[{"count":2,"href":"https:\/\/www.notiontechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/7424\/revisions"}],"predecessor-version":[{"id":7426,"href":"https:\/\/www.notiontechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/7424\/revisions\/7426"}],"wp:attachment":[{"href":"https:\/\/www.notiontechnologies.com\/blog\/wp-json\/wp\/v2\/media?parent=7424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.notiontechnologies.com\/blog\/wp-json\/wp\/v2\/categories?post=7424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.notiontechnologies.com\/blog\/wp-json\/wp\/v2\/tags?post=7424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}