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.
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.
If you haven't used the project before, follow the Setup instructions below, otherwise continue with Usage instructions.
-
Open the
index.jsfile. -
Locate the
FOLDER_IDvariable 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 is1-SazHPtZWFSj-DXn1a4955vzF3c7WLrz. This applies to folders with duplicate names too, as folder IDs are unique in Google Drive.
- Open your
NOTESfolder. DeleteOh, the Places You'll Go!.txt. - Move or paste all the .txt files you want to upload into the
NOTESfolder
- Open your terminal and navigate to the project's root directory.
- Run the following command:
npm run gdocify
This command executes the script, interacting with the Google Docs and Drive APIs as configured.
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 GDocifyFirst, 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.
- Select Hamburger Menu

- Select View All Products, then APIs & Services

- Select ENABLE APIS AND SERVICES

- Search for Google Drive API, select it, then select ENABLE

Before you can use your app, you must configure the OAuth Consent Screen.
-
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 nameas GDocify or whatever other name you wantUser support emailwith your emailEmail addresseswith your email
-
Manually the following scope by copying and pasting this link into the input box at the bottom and selecting ADD TO TABLE:
-
Verify the
.../auth/drivesbox is checked, then select UPDATE then SAVE AND CONTINUE

-
In the "Test users" page, select ADD USERS and input your email. Select ADD then SAVE AND CONTINUE
-
Review the "Summary" page before selecting BACK TO DASHBOARD
- From APIs & Services, navigate to Credentials

- Select CREATE CREDENTIALS then OAuth Client ID

- Under
Application type, select Desktop app. Then, select CREATE. OPTIONAL: Change name to whatever you want - Once your OAuth client is created, select DOWNLOAD JSON

- Rename the downloaded file to
credentials.jsonand move it into the repo'sconfigdirectory.
- If the folder name specified in
index.jsdoes 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.jsonand trying again. - Be cautious of quota limits for Google Drive and Docs API usage.
- Creating a Google Cloud Project
- Google Docs API Documentation
- Google Drive API Documentation
- Node.js Documentation


