Transforming Words and Pictures into an E-Book with Python


Hey there, fellow adventurers! Guess what? I’m a one-time coder diving back into the coding realm with excitement. Join me on this journey as I explore a Python program that turns words into magic! Picture this: a tool that transforms your ideas into a stunning e-book. The best part? I never coded in Python before but learned quiet a bit with the help of ChatGPT – so really speaking, no advanced coding skills needed! Let’s jump into the enchanting world of turning prompts into pictures and stories together!


The Excel Adventure: Unleashing the Power of Data

Our journey begins with a humble Excel file containing four columns โ€“ a numeric sequence, a topic, a prompt for an image, and a prompt for content. This simple spreadsheet acts as our guide, pointing our Python program to the unique combinations that will soon become a vibrant collection of images and text.

Check out some amazing eBooks here…

Calling the Wizards: OpenAI and Dezgo APIs

Once armed with our Excel insights, our Python script calls upon the wizards of technology โ€“ the OpenAI API and the Dezgo API. The OpenAI API creates enchanting content based on prompts, while the Dezgo API paints vivid images that bring those words to life. Together, they form a dynamic duo, weaving tales and crafting visuals with just a few lines of code.

The Word Document Chronicle: Capturing Every Moment

As our script dances through the Excel records, it weaves a captivating narrative and builds a gallery of mesmerizing images. But it doesn’t stop there; it updates a Word document in real-time, recording every twist and turn in our creative journey. The document serves as a canvas, waiting to be adorned with layout changes, colors, and additional details.

Into the Word Document Wonderland: A Canvas for Your Creativity

With the script complete, the user steps into the Word Document Wonderland. Opening the locally saved document, they have the freedom to tweak layouts, switch to A4, and add any personal touches. This is where the real magic happens, as the user shapes the raw material into their vision of perfection.

The Grand Finale: From Word to PDF to Canva Extravaganza

Once satisfied with the Word document’s transformation, it’s time for the grand finale. The user prints the document to PDF, preserving their masterpiece. But the journey doesn’t end there! They upload the PDF to Canva, a virtual playground for creative minds. Here, they can add frills, fancies, change page colors, and truly complete the transformation into a captivating e-book.

If you’re eager to witness the magic unfold and see this E-Book alchemy in action, I invite you to check out the step-by-step process in this YouTube video. Join me on this creative journey, and let’s bring words and images together in a symphony of storytelling!


In this creative odyssey, Python becomes the bridge between imagination and reality. The combination of OpenAI and Dezgo APIs, coupled with the versatility of Word and the creative freedom of Canva, empowers anyone, from a coding novice to a seasoned storyteller, to turn ideas into a visual feast. So, embark on this journey, let your creativity flow, and watch as words and images harmonize in a symphony of imagination. The canvas is yours โ€“ paint your story!

Check out some amazing eBooks here…


Translate ยป