Export your kindle highlights to Google Sheets.
kindle-highlights-to-googlesheets scrapes your kindle highlights from your Amazon Read page and exports them to a Google Sheet that you specify.
Checkout my exported highlights.
Your credentials for accessing Amazon & Google Sheets should be stored in a file named credentials.json.
Look at the credentials.example.json
file for reference.
Your amazon login credentials should be added to the username & password keys in credentials.json. This script requires your credentials to access your highlights at Amazon Read .
{
"amazon": {
"username": "your_email@gmail.com",
"password": "your_password"
},
...
This project uses the service account authentication flow for accessing Google Sheets.
To set it up, do the following:
- Go to the Google APIs Console.
- Create a new project.
- Click Enable API. Search for and enable the Google Sheets API.
- Create credentials for a Web Server to access Application Data.
- Name the service account and grant it a Project Role of Editor.
- Download the JSON file.
- Use the contents of the JSON file to fill the credentials key under sheets key in our credentials.json
"sheets": {
"sheetID": "XXXXXXXXXXXXXXXXXX",
"credentials": {
"type": "service_account",
"project_id": "XXXXXXXXXXXXXXXXXX",
"private_key_id": "XXXXXXXXXXXXXXXXXX",
"private_key": "XXXXXXXXXXXXXXXXXXx",
"client_email": "XXXXXXXXXXXXXXXXXX",
"client_id": "XXXXXXXXXXXXXXXXXX",
"auth_uri": "XXXXXXXXXXXXXXXXXX",
"token_uri": "XXXXXXXXXXXXXXXXXX",
"auth_provider_x509_cert_url": "XXXXXXXXXXXXXXXXXX",
"client_x509_cert_url": "XXXXXXXXXXXXXXXXXX"
}
}
- Copy the client_email value from the downoaded JSON file.
- Open Google Sheets & create a new spreadsheet.
- Now click the Share button in the top right, and paste the client email into the People field to give it edit rights.
- Copy the sheetID of this newly created spreadsheet. SheetID can be found from the URL of your spreadsheeet. For example: In this spreadsheet "https://docs.google.com/spreadsheets/d/14IiBOsxwf7AdgHjfZ5FMDgsf-rBXL4KufxhjeCWADhY/edit", the sheetID is "14IiBOsxwf7AdgHjfZ5FMDgsf-rBXL4KufxhjeCWADhY"
- Paste the sheetID against the sheetID key in our credentials.json file.
That's it. You're good to go.
First install the required dependencies by running:
npm install
To start the script, use:
npm start
The way it works right now, the script performs a full replace of any existing content in the spreadsheet. So any changes you make to the spreadsheet will be erased if you run the script again.
Storing your amazon credentials in a plaintext file is not a good idea. Make sure that you never commit the file to version control or make the file public.