Skip to content

Seamlessly transform your text files into Google Docs. Uses Google Drive API

aleguy02/GDocify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Socialify image

Upload all your plaintext files to Google Drive with GDocify. This app integrates with the Google Docs API and Google Drive API, allowing you to convert .txt files into Google Docs and upload them to a specific folder of your choice.

Prerequisites

Ensure you have a stable version of Node.js and Git installed on your system (tested with npm version 10.8.2) and a free Google Cloud Platform Account. This is required for API setup and credential configuration but, fortunately, easy to set up.


Usage Instructions

If you haven't used the project before, follow the Setup instructions below, otherwise continue with Usage instructions.

Step 1: Update Folder ID

  1. Open the index.js file.

  2. Locate the FOLDER_ID variable and set it to the ID of the folder you want to create your files in:

    const FOLDER_ID = "YourFolderName";

    Note: The folder ID can be found in the url when you open the folder in Google Drive. For example, if I'm in my "Notes" folder in Google Drive and the url is https://drive.google.com/drive/folders/1-SazHPtZWFSj-DXn1a4955vzF3c7WLrz?dmr=1&ec=wgc-drive-globalnav-goto, the folder ID will be the string after "folders/" and before "?". In this case, the folder id is 1-SazHPtZWFSj-DXn1a4955vzF3c7WLrz. This applies to folders with duplicate names too, as folder IDs are unique in Google Drive.

Step 2: Set Up NOTES folder

  1. Open your NOTES folder. Delete Oh, the Places You'll Go!.txt.
  2. Move or paste all the .txt files you want to upload into the NOTES folder

Step 3: Run the Project

  1. Open your terminal and navigate to the project's root directory.
  2. Run the following command:
    npm run gdocify

This command executes the script, interacting with the Google Docs and Drive APIs as configured.


Setup Instructions

Fork the Repository

Fork this repository to your GitHub account, then clone the forked repository to your local machine:

git clone https://github.com/your-username/GDocify.git
cd GDocify

Set Up Google Cloud Project

First, sign into or create a free Google Cloud Platform account, then create a new project. Or, click this link to go straight to the New Project page:
https://console.cloud.google.com/projectcreate
Name the project GDocify or whatever other name you want. You can leave the location as "No organization".

Next, enable the Google Drive API.

  1. Select Hamburger Menu
  2. Select View All Products, then APIs & Services
  3. Select ENABLE APIS AND SERVICES
  4. Search for Google Drive API, select it, then select ENABLE

Configure OAuth Consent Screen

Before you can use your app, you must configure the OAuth Consent Screen.

  1. From APIs & Services, navigate to OAuth Consent Screen

  2. Select External for User Type, then select the Create button. In the "OAuth consent screen" page, fill out the following then select SAVE AND CONTINUE.

    • App name as GDocify or whatever other name you want
    • User support email with your email
    • Email addresses with your email
  3. In the "Scopes" page, select ADD OR REMOVE SCOPES

  4. Manually the following scope by copying and pasting this link into the input box at the bottom and selecting ADD TO TABLE:

    • https://www.googleapis.com/auth/drive

  5. Verify the .../auth/drives box is checked, then select UPDATE then SAVE AND CONTINUE

  6. In the "Test users" page, select ADD USERS and input your email. Select ADD then SAVE AND CONTINUE

  7. Review the "Summary" page before selecting BACK TO DASHBOARD

Configure OAuth Credentials

  1. From APIs & Services, navigate to Credentials
  2. Select CREATE CREDENTIALS then OAuth Client ID
  3. Under Application type, select Desktop app. Then, select CREATE. OPTIONAL: Change name to whatever you want
  4. Once your OAuth client is created, select DOWNLOAD JSON
  5. Rename the downloaded file to credentials.json and move it into the repo's config directory.

Notes

  • If the folder name specified in index.js does not exist in your Google Drive the script will throw an error.
  • If you encounter an error that your token has expired, try deleting token.json and trying again.
  • Be cautious of quota limits for Google Drive and Docs API usage.

Helpful Resources


About

Seamlessly transform your text files into Google Docs. Uses Google Drive API

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published