Overview

I had the opportunity to create an anonymous file uploader using Google Drive and Google Apps Script, so this is a memo of the process.

I referenced the following article.

https://qiita.com/v2okimochi/items/06ed1ce7c56a877a1e10

Creating the Web App

First, access Apps Script from the following URL.

https://script.google.com/

Click “New project.”

The following screen will be displayed.

Copy and paste the following code. For the second line, <Google Drive upload folder ID>, create an upload folder in Google Drive in advance and obtain its ID.

cf}f}ouunnrncccrsdcepcaaaoouetottrtrrrnnst:GiuoisstuFeorcofutttorGOtnnenopomnoLsrldfcFoDdHspmoaouofgE:otFrBaylslolRGmoolddtdle_ielrcoF=eoedIntSmebormreDDd(eslnNF.rre)rs=deaocNi=xv:Fewmlrav.{iofr使edemehcroDeae<temr=a=rt;Gm.(mteolcfODet=Forobr(oigerji)dullamev;apeetOceyl(ebtA.ofDHj.ptaortempodrimcy.SFmvltFgtoBeO)ierllIultidoDt{eFnebpG;ogr)uol(.;tod)cFge;rrlreoeBamytFDIeirdFli(oevFlI(eOdD'Le>iDr'nE(;dRfe_oxIl'Dd))e;;rName);

Next, click the “+” button in the upper left of the screen and select HTML.

Name the file “index.”

Copy and paste the following code.

<<!h/Dt<<hOmh/b/tCle<<ho<bmT>abs/edd/olYdacf}wd}f}f}f}sayi<<dd>P>sruio,uuucd>vf/diyEeinvf}ncdncccci}}ndcdgnvdr>o<<fiv>pcaoduofcoooofcooiocaiiiriiov>htttrrf}omcatnnnnueutcnvotrvpdmnnrta>io)weulissss(plpius.gi.t=ppmimrofre;.nmsottttllslomtilodi>"ouu>dlgnovmvateeneoeoneneninmntt=>erased.n)lsmunaandn.vnys"tpmr[ndat;ceiapd{dhtiesuefuiip=rsitEd.hnzxl>BBa.vrcp=robddr"ei].vdgaeSouungHrdHrm==o_v=.peEen=ia0ttde=TiadTmi""gte=arnvtg=zdttltMptoM"tfuronddeteEedeB&ooeEdLtecL=ipepto0dvLnlSodu&nnFlo.Vus"lls"Fc;Eeiteuco=t..oec=rim=theos>ouvnsLmbuctsddrmuueeya"a"rmiettiemmu1oiiimem'unwn`lnd>menDesniem0nzssSnep.(t<edn"<Sn<tentttne2eaautndwi.d=la/utLfeeBBtn4=bbbBtaidgi"emtdb.fiarnyu.t<llmy.tt)evtFeyimqosu(eItg.deeiIgeht>eo=pviurtl'rdtegomddtdeVS{Ex1r"e>temetl((ote1ca((tiult0mm=(rsn(o""nEt0ux==f"E.ece-MSy")y.e)aDu(lE2mSoul.wcmaBuFsSlr;dOp)el4eiftrpe.(eelbiu{ee('Mlmenzarmlm')snimlbln',Co{emteluOoe;stgiemegsoane.)sebanHBn<t"ictupndtn1ge;jdtay:b(tthbrt"Bt0e{;e"BnIcrtt"o;mee)yB;tc)ydde>hyrivn.IyEt.Il(n<ipvAitetddIl)dde'tbseal+'nLi(dei(rmer)=ll+,tos"(m{s'(y<r>""u()Faaf"1eapuf;>fe'fodbif0nbrpd"i=f{urelliMtlodri>l"onmdeelBBegamvercS"d"eydrt'>"mtu,)"Iee)`'ib=.)d=sV;;o)omff.(sin;niutif"t'ec(tnrliur)wh"e)cuelpu;)av;tesele.nei;.so;pgnol[aretne0do=)n]"c"g.)ec{ts;shhisa{;zFneog;remS(ufbomrimtOBbujtetcotn)(;)"

Deployment

Click the “Deploy” button in the upper right of the screen, then click “New deployment.”

Click the gear icon and select “Web app.”

Set “Execute as” to yourself and “Who has access” to everyone.

Proceed with the authorization.

A warning screen like the following will appear. Click “Advanced.”

Click the “Go to …” link.

As a result, the following screen will be displayed. Access the URL at the bottom of the screen.

You can access a web app like the following.

When you upload a file, a time-based folder will be created in the Google Drive folder whose ID you specified earlier, and the uploaded file will be stored inside it.

Summary

I introduced how to create an anonymous file uploader using Google Drive and Google Apps Script.

If you want to change the target upload folder ID, you can edit “Code.gs” and perform a “New deployment.” However, in this case, a new URL will be issued. If you want to continue using the URL from the previous version, you can change the version specification from “Manage deployments.”

For details, please refer to the following article.

https://ryjkmr.com/gas-web-app-deploy-new-same-url/

I hope you find this article helpful.