Search code examples
google-apps-scriptgoogle-apigoogle-api-php-clientgoogle-forms

Is there a way to programmatically get a shareable link for google form?


Is there a way to programmatically get a shareable link for google form? I've copied a google form file using php api and now I want to get a sharable link to this form.


Solution

  • A shareable URL of a Google Form is of the form

    https://docs.google.com/forms/d/{id}/viewform
    

    where id is the Id associated with the file containing the form. Since you have made a copy of the file, you have a corresponding File object, so use the method for getting its id, and include it in the URL.