'How to extract URL of created html form using google app script
I'm using google app script to build something like a form that helps me with automation.
here's the code for building my form
<div class="w3-container w3-section">
<div class="form-container">
<div class="spacing">
<input class="input-like" placeholder="Enter video link" id="vid" type="text"/>
</div>
<div class="spacing">
<select class="input-like" id="vcategory">
<option value='' disabled selected hidden>Select video category</option>
<option value='Film & Animation'>Film & Animation</option>
<option value='Autos & Vehicles'>Autos & Vehicles</option>
<option value='Pets & Animals'>Pets & Animals</option>
<option value='Sports'>Sports</option>
<option value='Travel & Events'>Travel & Events</option>
<option value='Gaming'>Gaming</option>
<option value='People & Blogs'>People & Blogs</option>
<option value='Comedy'>Comedy</option>
<option value='Entertainment'>Entertainment</option>
<option value='News & Politics'>News & Politics</option>
<option value='How to & Style'>How to & Style</option>
<option value='Education'>Education</option>
<option value='Science & Technology'>Science & Technology</option>
<option value='Nonprofits & Activism'>Nonprofits & Activism</option>
</select>
</div>
</div>
<div class="button-wrapper">
<button class="w3-blue" onclick="addRow()">Add</button>
</div>
<div class="button-wrapper">
<div class="alert alert-success" id="ok" style="display:none">
<h3>Thanks</h3>
<p>This is a new one</p>
</div>
<div class="alert alert-danger" id="warn" style="display:none">
<h3>Duplicate!</h3>
<p>The video ID or Name is already on the list</p>
</div>
<div class="alert alert-warning" id="missing" style="display:none">
<h3>Input missing!</h3>
<p>Viedo link or Category is missing</p>
</div>
</div>
</div>
At this point everything works fine and I can see my Form when I deploy.
I get the forms values through a function that send these values to doGet() function and I add them to the spreadsheet cells.
What I want to do, is when I do run this script .. it sends me to a new tab containing the created form, as this form is not created as a submenu in the spreadsheet, it's completely in another page/tab .. I want to get this page/tab url as I need to access it's parameters in the future.
I tried to use google.script.url as in the documentation but it sent me empty object,
I tried to use window.location.href, it sent me a weird URL that I couldn't recognize and it's not the one for the created tab.
Any help would be appreciated :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
