429 Error on Google Sheets script pulling from Google Books API
08:58 28 May 2026

I've created a Google Sheet where I enter a book ISBN in cell A2 and want the book title returned in cell B2 upon the click of a button that I've associated with function getBookData(). However, my script always crashes out on:

    var response = UrlFetchApp.fetch(url);

and gives me the following 429 error: Exception: Request failed for https://www.googleapis.com returned code 429. Truncated server response: { "error": { "code": 429, "message": "Quota exceeded for quota metric 'Queries' and limit 'Queries per day' of service 'books.googleapis.... (use muteHttpExceptions option to examine full response)

What's going on here? It's not stuck in a loop. If I go to executions data, it's only executing when I press the button to start the function. So I'm not sure how I'm exceeding a query limit. I've tried muting exceptions but then the fetch returns nothing so there's no array to be pulling a book title from.

Full function code here:

const API_URL = "https://www.googleapis.com/books/v1/volumes?country=US";

function getBookData() {
  var looker = SpreadsheetApp.getUi();
  var response = looker.alert("Oooo", "Should we look up this book?", looker.ButtonSet.YES_NO);

  if (response == looker.Button.YES) {
    var activeSheet = SpreadsheetApp.getActiveSheet();
    var bookISBN = activeSheet.getRange("A2").getValue();
    looker.alert("bookISBN: " +bookISBN);

    var url = API_URL + "&q=isbn:" + bookISBN;
    
    var response = UrlFetchApp.fetch(url);

    var results = JSON.parse(response);

    var book = results.items[0];

    var title = (book["volumeInfo"]["title"]);

    activeSheet.getRange("B2").setValue(title); 
  }

}
google-sheets google-apps-script http-status-code-429 google-books-api