• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
project logo

nucky

book-lookup-notion

use google book api to look up bibliographic metadata elements
Public
Like
1
book-lookup-notion
Home
Code
3
backend
4
frontend
1
README.md
Branches
1
Pull requests
Remixes
1
History
Environment variables
2
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
5/27/2025
Viewing readonly version of main branch: v80
View latest version
README.md

📚 Notion Book Database Auto-Populator

Automatically enrich your Notion book database with metadata from Google Books API!

This tool can pull metadata about books into a Notion database.

Fill out those empty fields in your reading databasen with one click and a simple query to the Google API.

Convert that note on your phone into ISBNs to upload onto StoryGraph, LibraryThing or Goodreads.

🚀 Quick Start

Step 1: Create Your Notion Database

Create a new Notion database with these required columns:

Column NameTypeDescription
TitleTitleThe book's title
AuthorRich TextThe book's author
ISBNRich TextBook's ISBN (auto-filled)
Year PublishedNumberPublication year (auto-filled)
Page CountNumberNumber of pages (auto-filled)
PublisherRich TextPublisher name (auto-filled)

Optional columns you can add for even more data:

  • Description (Rich Text) - Book summary
  • Categories (Multi-select) - Genres/subjects
  • Average Rating (Number) - Google Books rating
  • Ratings Count (Number) - Number of ratings
  • Language (Rich Text) - Book language
  • Subtitle (Rich Text) - Book subtitle

Step 2: Set Up Notion Integration

  1. Create a Notion Integration:

    • Go to https://www.notion.so/my-integrations
    • Click "New integration"
    • Give it a name like "Book Auto-Populator"
    • Copy the Integration Token (starts with secret_)
  2. Share Your Database:

    • Open your book database in Notion
    • Click the "..." menu → "Add connections"
    • Select your integration
  3. Get Your Database ID:

    • Copy the URL of your database page
    • Extract the database ID (the long string of letters/numbers after the last / and before any ?)
    • Example: https://notion.so/myworkspace/a8aec43384f447ed84390e8e42c2e089?v=...
    • Database ID: a8aec43384f447ed84390e8e42c2e089

Step 3: Configure This Val

  1. Fork this Val to your account
  2. Set Environment Variables:
    • NOTION_API_TOKEN = Your integration token from Step 2
    • NOTION_DATABASE_ID = Your database ID from Step 2

Step 4: Test It!

  1. Add a test book to your Notion database:

    • Enter just the Title and Author (like "The Great Gatsby" and "F. Scott Fitzgerald")
    • OR just enter an ISBN (like "9780743273565")
  2. Run the enrichment:

    • Visit your Val URL: https://your-val-name.web.val.run/
    • Watch as the missing fields get automatically filled in!

📖 How to Use

Adding Books (Two Methods)

Method 1: Title + Author

  • Add the book title and author to a new row
  • The script will find and fill in ISBN, year, page count, publisher, etc.

Method 2: ISBN Only

  • Add just the ISBN to a new row
  • The script will find and fill in title, author, year, page count, publisher, etc.
  • Perfect when you have a book in hand but don't want to type details!

Running the Enrichment

Process all incomplete books:

GET https://your-val-name.web.val.run/

Check if everything is set up correctly:

GET https://your-val-name.web.val.run/status

Process just one specific book:

GET https://your-val-name.web.val.run/process/NOTION_RECORD_ID

See all available commands:

GET https://your-val-name.web.val.run/help

🔗 Linking to Your Main Reading Database

Want to connect this lookup database to your main reading tracker? Here's how:

  1. In your main reading database, add a new property:

    • Name: "Book Info"
    • Type: Relation
    • Related database: Your book lookup database
  2. Add rollup properties to display the metadata:

    • ISBN: Rollup → Book Info → ISBN
    • Year: Rollup → Book Info → Year Published
    • Pages: Rollup → Book Info → Page Count
    • Publisher: Rollup → Book Info → Publisher

Now when you add a book to your reading list, just link it to the enriched record!

✨ What Gets Auto-Filled

This tool pulls metadata from Google Books API:

Always Filled:

  • ✅ ISBN (prefers ISBN-13, falls back to ISBN-10)
  • ✅ Publication Year
  • ✅ Page Count
  • ✅ Publisher

Often Available:

  • 📝 Description/Summary
  • 🏷️ Categories/Genres
  • ⭐ Average Rating
  • 📊 Number of Ratings
  • 🌍 Language
  • 📅 Full Publication Date
  • 🔗 Google Books Preview Link

WARNING! Check the data! Google Books is not the authorative source on publisher data, but more authorative sources charge money to use their API.

Ironically, manually Googling every book has a higher certainty rate, but it's very time consuming and probably the reason why you're here.

Protip: if you want more data, pull your ISBNs, then upload them to LibraryThing.com

🛠️ Troubleshooting

"System not properly configured" error:

  • Check that both environment variables are set correctly
  • Verify your Notion integration has access to the database

No books getting processed:

  • Make sure you have books with Title+Author OR ISBN but missing other fields
  • Check that your database column names match exactly (case-sensitive)

Books not found:

  • Try adding more specific author information
  • Some books may not be in Google Books database
  • Check that Title and Author are spelled correctly

🔧 Advanced Usage

Manual Processing: The system only processes books when you visit the URL - no automatic background processing, but you could probably set that up if you wanted.

Smart Matching: Uses both exact and relaxed search algorithms to find the best matches, which sometimes gives false results

Data Preservation: Only fills in empty fields - never overwrites your existing data

Expandable: Add any of the optional columns to capture even more book metadata

📁 Project Structure

  • backend/index.ts - Main HTTP endpoints and API
  • backend/notion.ts - Notion database integration
  • backend/books.ts - Google Books API integration
  • backend/processor.ts - Core processing logic

Fork this Val and fill in your book database! 📚✨

FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.