michael-gracie / gslides

Wrapper around Google APIs to create charts in Google Slides with python
https://michael-gracie.github.io/gslides
MIT License
31 stars 6 forks source link

Possible improvement suggestion: Update text from existing text boxes #50

Open kodackx opened 2 years ago

kodackx commented 2 years ago

Description

First of all, I would like to say that gslides is a great tool and it beats using the official Slides API for a lot of use cases. However, there's a particular use case that I have encountered where I am looking to edit text from existing presentations in a user's GDrive. It would be great if gslides could target a particular text box ID and perform a search and replace or altogether replace the text in that text box. This would be very useful for setups where people make use of a template that they copy over for different projects but for which they just need to update some text and/or graphs.

michael-gracie commented 2 years ago

Thanks for the kind feedback! I'm glad you've found it useful.

Have you explored the template method? Instead of searching a specific text box id it will search the entire presentation for a string and replace that string with a variable of your choosing. See usage of this method in the second last cell in this notebook. I know this templating doesn't happen at the text box level and rather the presentation level but I was wondering if this meets your use case?

Let me know!

kodackx commented 2 years ago

I ended up writing Slides API code to achieve it in the end but I totally missed the .template() method! It would have totally worked so I'll keep it in mind for future uses of gslides. I must have thought the method does something more complicated than what I actually needed it to do. Maybe it's worth considering renaming the method? .textUpdate() or .textReplace() could be a more direct representation of how the method works.

Thanks again for your input and work!