Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does gspread-formatting support changing text colors of a substring in a cell? #54

Open
Amerimac-Github opened this issue Apr 24, 2024 · 2 comments

Comments

@Amerimac-Github
Copy link

Amerimac-Github commented Apr 24, 2024

I'm looking to build a utility that checks the spelling of one cell against another, and color codes individual words. Is this possible with gspread-formatting ? If so, please just mention the feature/method and I can figure it out from the docs (I just don't see it at first pass through the read the docs). The docs are good I just can't find this capability. Is it possible or do I need to handroll w the native sheets API?

image

@robin900
Copy link
Owner

Sheets API support for "text format runs" is pretty new, and the textFormatRuns array property of CellData didn't exist when gspread-formatting was authored.

This is a good feature to request. I'll make this issue a feature request and work on it should begin fairly soon.

In the meantime, you need a workaround. I recommend exploring the API of Worksheet in the gspread package, and find a way to do a batch update with a RepeatCellRequest for each cell you want to have mixed formatting. Look in the Sheets API docs for RepeatCellRequest, CellData and TextFormatRun for guidance. Good luck!

@Amerimac-Github
Copy link
Author

@robin900 thanks, will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants