javascript - How To Include a google apps script in a html page,that has uploading functionality on google Drive -
i want collect files users (like resume) & store on google drive. working file google apps script below.i want add form html page. provided google form url
https://script.google.com/macros/s/akfycbx8w-um_piwx8a1s_3r2crsyhqqylf6tyyjoquuhdft5jqbfp0/exec
want add in shouttoday.com site's page. tried include js script,or iframe not working.
there files ---
server.gs
function doget(e) { return htmlservice.createhtmloutputfromfile('form.html'); } function uploadfiles(form) { try { var dropbox = "student files"; var folder, folders = driveapp.getfoldersbyname(dropbox); if (folders.hasnext()) { folder = folders.next(); } else { folder = driveapp.createfolder(dropbox); } var blob = form.myfile; var file = folder.createfile(blob); file.setdescription("uploaded " + form.myname); return "file uploaded " + file.geturl(); } catch (error) { return error.tostring(); } }
form.html
<form id="myform"> <input type="text" name="myname" placeholder="your name.."> <input type="file" name="myfile"> <input type="submit" value="upload resume" onclick="this.value='uploading..'; google.script.run.withsuccesshandler(fileuploaded) .uploadfiles(this.parentnode); return false;"> </form> <div id="output"></div> <script> function fileuploaded(status) { document.getelementbyid('myform').style.display = 'none'; document.getelementbyid('output').innerhtml = status; } </script> <style> input { display:block; margin: 20px; } </style>
having url app script url: https://script.google.com/macros/s/akfycbx8w-um_piwx8a1s_3r2crsyhqqylf6tyyjoquuhdft5jqbfp0/exec
but don't know how embedded app (form) in html page.
you need use google developer console this. have programming example available same. so, you.
Comments
Post a Comment