/Google_Drive_Handler

Google Drive file upload and delete script.

Primary LanguageJavaScript

Upload to your Google Drive with terminal itself

Steps to get started with the Script

  1. Clone the Repository
  2. Create .env File
  3. Create a Project at GCP
  4. Enable Google Drive API under Enable API and Services Enable_API
  5. Under API and Services Generate a OAuth 2.0 Client ID
  6. Pase https://developers.google.com/oauthplayground as Redirect URI inside the OAuth 2.0 Client ID Generate_OAuth_Credentials
  7. Whitelist your Email Address Under OAuth Consent Screen section WhiteList_Email
  8. Go to OAuthPlayground
  9. Select Google Drive V3 and Paste your Client Id and Client Secret Generate_Refresh_Token
  10. Exchange Authorization code with Refresh Token and Access Token Authorization_Code_Exchange
  11. Add the following inside your .env file which you created earlier
KEY value
CLIENT_ID yourClientID
CLIENT_SECRET yourClientSecret
REDIRECT_URI yourRedirectURI
REFRESH_TOKEN yourRefreshToken
  1. Place your file at the dir
  2. Install required packages
  3. Note: To upload the file run yarn upload "fileName" "mimeType" "folderId (if you want to upload inside a folder)"
  4. Note: To delete the file you need the files' FILEID and run it as yarn delete 'FILEID'
  5. Note: To create a folder you need to run yarn createFolder 'folderName' Example_Code
  6. Once you are done the setup you only need to run follow Steps after Step 11 everytime.

Star the Repository if you like my work