Skip to content

Instantly share code, notes, and snippets.

@phillypb
Created October 23, 2025 08:38
Show Gist options
  • Select an option

  • Save phillypb/3bc35a5123d4e01745911ca9aa87a5fc to your computer and use it in GitHub Desktop.

Select an option

Save phillypb/3bc35a5123d4e01745911ca9aa87a5fc to your computer and use it in GitHub Desktop.
/**
* Code for: Publish a Google Form to your domain
*
* DEVELOPED BY THE GIFT OF SCRIPT: https://www.pbainbridge.co.uk/
*/
function setAnyoneInDomain() {
// Form ID
var formId = "YOUR FORM ID HERE";
// Publish the Form
FormApp.openById(formId).setPublished(true);
// set Form permissions for Drive API
var options = {
domain: "YOUR DOMAIN HERE",
type: "domain",
role: "reader",
view: "published",
};
// optional argument for Shared drives
var optionalArgs = {
supportsAllDrives: true
};
// create the permissions
Drive.Permissions.create(options, formId, optionalArgs);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment