Is there a way to estimate width and height for a sticky note based on amount of characters?

edited November 15 in Mural API

I'm working on a python app which reads a csv file and inputs the data into a sticky note. It works great when there is a small amount of text but when there is a large amount of text for example more than 1000 characters it is difficult to estimate the height/width which looks right and fits. Right now I am using a fixed width of 400px (this can change if someone has a better recommendation) and then I estimate the height by multiplying the number of characters in the string by 1.5. This calculation works good for certain amount of characters but not a large amount. Wondering if someone has done this before or can help?