Creating an overview of all my e-books, including their google books summary

23 July 2021

Article written by Jeanine Schoonemann, Principal Consultant

If, like me, you are a book lover who devours books, you are probably also familiar with the problem of bringing enough books while traveling. This is where the e-book entered my life, and it is definitely here to stay. But how to keep track of all my e-books? And how do I remember what they’re about by just seeing their title? And, the worst of all problems, how to pick the next book to read from the huge virtual pile of books?

After struggling with this for years, I finally decided it was time to spend some time solving this problem. Why not create a Python script to list all my books, retrieve their ISBN, and finally find their summary on Google Books, ending up with an Excel file containing all this information? And yes, this is as simple as it sounds! I’ve used the brilliantly simple ISBN tools package and combined this with the urllib package to get the summary from Google Books. Easy does it! And the result looks like this:

excel overview e-books

If you’re curious on which book to read next now you’ve got such a nice list of all the books you’ve already read, you should definitely check out our fantastic book recommender to help you find your next best book.

 

Take a tour in the code

Initialize

Let’s start by importing packages and initializing our input information, like the link to Google Books, the file path where my books can be found, and the desired name of the Excel file we want to create.

file path e-books 1-12 (1) overview e-books

 

Check for an existing file with books

Next we want to check if we’ve run this script before and if there is already a list of books. If this is the case we will leave the current list untouched and will only add the new books to the file.

file path e-books 1-6 (2) overview e-books

 

Retrieve all books

Now we walk through all folders in the given directory and only look for pdf and epub files. In my case, these were the only files that I would consider to be books.

file path e-books 1-19 (3) overview e-books

 

Only process the newly found books

We don’t want to keep searching online for ISBN and summaries of the books we’ve already found before. Therefore we will remove all books from the existing file with the list of books (if this existed). If there wasn’t already such a list, nothing will happen during this step.

file path e-books 1-11 (4) overview e-books

 

Find the books online

For all the new books, we want to search for their ISBN using the book title (name of the file). Using this ISBN, we will try to find the summary of the book in Google Books.

file path e-books 1-23 (5) overview e-books

 

Store the list of books in Excel

Finally, we combine the existing list of books with all new books we’ve found and store this complete overview in the Excel file. We’re all done now and good to go.

file path e-books 1-6 (6) overview e-books

It’s definitely not perfect yet since the ISBN is matched using the title, which won’t be correct all the time, but I had a lot of fun creating this script, and I hope you’ll have fun using it!

This article previously appeared on TheAnalyticsLab.com.

Contact

Do you want to know more about this subject? Please contact Jeanine Schoonemann using the details below

Jeanine Schoonemann, Principal Consultant

+31 6 55 89 75 12

j.schoonemann@cmotions.nl

Latest news

Nachos Hackathon 2022

7 September 2022

We don’t know if you’ve heard already, but there is yet another crisis on our horizon:... read more

What we learned from kaggle’s commonlit readability prize 

15 September 2021

Project-Friday At Cmotions, we love a challenge. Especially those that make us both think and have... read more

Can machine learning assess the readability of texts?

8 September 2021

In May, we kicked off another Project Friday. This time, a group of seven Cmotions colleagues,... read more

Subscribe to our newsletter

Never miss anything in the field of advanced analytics, data science and its application within organizations!