Attach document or file button is not working in my HTML web app -
attach document or file button not working in html web app -i able records other outputs in sheet except attachment.
below sample code, users should able upload attachment while submitting form , backend attachment should stored in google drive users name
sample sheet, code , html webapp
function doget(e) { return htmlservice.createhtmloutputfromfile('index').settitle("testing"); } function uploadfiletogoogledrive(data, file, name, email) { try { var dropbox = "supplier management team (file responses)"; var folder, folders = driveapp.getfoldersbyname(dropbox); if (folders.hasnext()) { folder = folders.next(); } else { folder = driveapp.createfolder(dropbox); } var contenttype = data.substring(5,data.indexof(';')), bytes = utilities.base64decode(data.substr(data.indexof('base64,')+7)), blob = utilities.newblob(bytes, contenttype, file), file = folder.createfolder([name, email].join(" ")).createfile(blob); return "ok"; } catch (f) { return f.tostring(); } }
Comments
Post a Comment