🐴 How I built a simple tool from scratch with the help of AI
Challenges, solutions, and prompts
“Xinran, do you know any tools that can convert a document to Google Slides?”
Last month, a lawyer friend texted me about a tedious task, asking for a quick solution. I searched online and shared two tools, but options were surprisingly limited.
A few weeks later, while on my flight from Mexico to New York, an idea came to mind:
What if I could use AI to build a small tool that can quickly turn a document into a Google Slides presentation?
So after spending some time in front of my computer, I built a simple tool to achieve below:
Take a structured Google Doc and turn it into a slide deck instantly.
Simply rerun the script if the Doc has any updates.
Automatically preserve bullet points.
In today’s newsletter, I’ll share a behind-the-scenes look at the process:
The goal
The key challenges I faced
How I overcame the challenges
Summary
Let’s dive in.
The goal
The idea was simple: I wanted to automatically convert text from a Google Doc to Google Slides.
Each heading in the Doc would become a new slide title, and the paragraphs and bullet points beneath it would fill the slide’s content.
Ideally, this would instantly result in a structured and clean presentation.
Challenges and how I overcame them
1. Many bugs occurred due to incomplete setup.
Almost immediately after starting the experiment, I ran into a series of bugs.
Issues
The Google Cloud Console showed the error "You haven't configured any OAuth clients for this project yet."
The script failed to run because the required Python libraries (google-auth-oauthlib, google-api-python-client) were not installed. This caused errors like ModuleNotFoundError.
The script returned a 403 Forbidden error with the message "Request had insufficient authentication scopes."
Prompts Used to Debug
Why is my Python script failing with a 'ModuleNotFoundError' for 'google-auth-oauthlib' and 'google-api-python-client'? How do I fix this?
Why am I getting a '403 Insufficient Authentication Scopes' error when accessing Google Docs or Slides APIs? How do I fix this?
Why is Google Cloud Console showing 'No OAuth clients configured,' even though I created one? How do I properly configure OAuth credentials?
Solutions
Went to Google Cloud Console to created OAuth credentials.
Downloaded the credentials.json file.
Verified the project in Google Cloud Console.
Enabled the APIs (Docs, Slides, Drive).
Updated the SCOPES list in the script to include all required permissions.
Deleted the old token.json file to force reauthorization with the updated scopes.
Installed the missing libraries on my computer, particularly Python.
After spending about an hour configuring, I was finally able to convert text from Google Doc to Slides with just a click of a button.
2. All text landed on one slide.
My excitement of seeing the initial result didn’t last long.
Issue
The entire content of the Google Doc was placed onto a single slide, making it completely unusable.
This is what appeared on Google Slides:
Prompt Used to Debug
When converting a Google Doc to Google Slides, why is all the text ending up on one slide instead of creating separate slides?
Solution
The issue was that the headings in the Doc were not styled as "Heading 1." Formatting them properly resolved the problem.
3. Several visual details needed to be fixed.
While I was generally satisfied with the result, my perfectionist side wanted to refine it further to make it look even better.
Issues
Titles and content were a bit far apart.
Bullet Points were missing, inconsistent with the Google Doc.
The slides would look better with a subtle background color.
Prompts Used to Debug
1. In the generated Google Slides presentation, the title and the sentence above the bullet points have too much vertical gap. How can I adjust the positioning of text boxes to reduce this space?
2. The bullet points from the Google Doc are not appearing as bullets in Google Slides. How can I update the code to ensure bullet formatting is preserved in the slides?
3. How can I update the code to set a very subtle gray background color for the slides?
Solutions
The solution was to adjust the translateY property of the normal text box to move it closer to the title.
I added logic to detect bullets based on listId and bullet properties in the Doc. Then, in Google Slides, I applied a createParagraphBullets request to format them correctly.
I added an updatePageProperties request, then I was able to apply a background color. I tweaked the rgbColor values to 0.98, 0.98, 0.98 for a subtle gray that gives a modern visual touch.
Summary
Initially, I thought it would be a quick 30-minute task with Claude’s assistance. However, there were more obstacles than expected:
I had to set things up on Google Cloud console—an unfamiliar territory for me.
I had to download the relevant Python libraries and configure my VS Code editor.
I had to navigate my computer terminal to make sure things are installed properly.
I had to make various code adjustments to make the slides visually look better.
There were also some random hurdles, such as Claude reaching its usage limit, which forced me to switch to ChatGPT (GPT-o1) midway through the process.
Regardlessly, it was a rewarding experience.
My coding knowledge is quite basic—I took a couple of coding courses over a decade ago in grad school, but the only thing that I still remember is probably the trauma of spending an entire Saturday afternoon debugging code.
However, with the help of AI this time, I successfully debugged many issues and made customizations.
In the future, the tool can be further improved such as addressing edge cases, referencing sample presentation slide styles, and potentially incorporating image placeholders.
Thanks for reading.
Happy New Year!
Xinran
-
P.S. I took a week off during the holiday season without checking emails or social media, and I don’t plan to check them until next Monday.
It felt odd—I’m used to reacting in time—but it was a rare chance for me to have a peace of mind, stepping away from worrying about future projects or overthinking past regrets.
My wife mentioned that I seemed more present, and I had to agree.
How was your holiday season? Did you do anything fun?
Let me know in the comments.
This looks like so much fun! Thanks for sharing. If your coding knowledge is “basic”, mine is practically non-existent. I am setting aside time to learn.