This repository provides a step-by-step guide and Python scripts to add documents to your Mendeley library using their DOIs. The process includes creating an app on Mendeley, getting an access token, extracting DOIs from text using ChatGPT, preparing a text file with the DOI list, and running the script to import the documents to Mendeley.
- Go to the Mendeley Developer Portal.
- Sign in with your Mendeley credentials.
- Click on the "My Apps" link in the top-right corner.
- Click on the "Create App" button.
- Fill in the required fields:
- Name: Choose a name for your app.
- Description: Write a brief description of your app.
- Redirect URL: Use
https://localhost
for personal use.
- Click "Create App" to finish the process.
You should see an ID number (e.g. 1234, which is you Client_ID), your app name, and the Client_Secret. You'll need the Client_ID and Client-Secret.
- Use ChatGPT, ask it to "Make a list of DOIs from this paragraph" (or notes or whatever), followed by pasting in the paragraph.
- Copy the extracted DOIs for use in the next step.
- Open your terminal and create a new text file, e.g.
vi dois.txt
- Paste the extracted DOIs into the file, one per line.
- Make sure to save the file with a
.txt
extension (e.g.,dois.txt
).
- Clone this repository or download the Python script
upload-DOI-to-library.py
. - Open the
upload-DOI-to-library.py
file and swap in your client ID, client secret, and your email and password for Mendeley. Make sure to save. - Update the
dois_file
variable to the path of your text file containing the list of DOIs (if you made it in a different file, also check to make sure it matches the name you gave it). - Run the script from the command line:
python upload-DOI-to-library.py
.
Note: you may also need to pip install selenium
and also download a Chrome webdriver if you don't already have it. (The download is as simple as clicking the download button and opening the zip file). You may also need to eventually pip install webdriver
if it gives you an error.
- The script will open a Chrome window and you'll watch it log in for you and then close the browser window automatically. This generates an authorization code that's then used to generate an access token automatically. This lasts for an hour.
- The script will then attempt to import each document with the available metadata to your Mendeley library. You can open your library in a browser and watch them get added as it syncs; you can also see a list of all the DOIs it added via the command line.
Example output when the script successfully finishes: