Mike Levin SEO

Future-proof your technology-skills with Linux, Python, vim & git... and me!

Google Spreadseet API Doesn’t Allow Formatting

by Mike Levin SEO & Datamaster, 01/31/2012

Okay, this next step is dear to my heart. I have thus far resisted using templates, favoring instead making documents from scratch, because it seemed so much more pure. But the truth is, I have dependencies left-and-right in this application—not the least of which is the gdata-python-client (the Google Data Python client librarires). And the advantages of switching to a template model are so much larger than my perceived “purity” advantages, that it’s time to take the plunge permanently. Making such architectural refactorings to the main codebase is always a bit painful and difficult, because you sort of want to leave your options open, but you don’t want to make the code ugly.

For now, I am going to simply swap the file-copying code for the file-creating code, commenting out the file-creating code. I will not make optional different behavior.

Very interesting! Another oddity of the Google Data API is the convoluted process to get the document key, after having done something such as creating or copying a document. Thankfully, it looks like the approach to getting the document key after duplicating an existing document is the same as if you created one from scratch. That is: you are sitting on top of a new document entity object, conventionally called entity in Google example code.

Wow, this is very interesting to me. Until you pre-populate column labels, there is really no difference between copying a template file and starting a new file from scratch, so now that I have the template code it, I can test it by making the template empty. It should in all other regards work exactly as if I made the new file from scratch. I will have to do a little arbitrary formatting just to know that the copying of the template even worked… okay, success, with only one scope snafu that I had to iron out. This is the downside of place where not having my daily journal intermixed with the code-base. The revision control system would have these comments instead of my blog. But the benefit of working publicly to keep myself single-mindedly on-topic is worth it.

Pshwew! Okay, today was a very successful chisel-strike day. I have successfully converted document-creation over to template-copying. There were tons of little distractions of phone-calls to meetings, but by just keeping my ambition-level for today just so large, and fixing on it with laser beam focus, I was able to get it done. I have to keep refining the app to prep it for the public by actually using it every day, and frequently. Get the very core, basic features down solid.

Okay, it’s now 5:40, and I will be heading out by 6:00 PM, as I always almost do lately as a new daddy, anxious to get home and participate in raising my child who is just a delight, at nearly 15-months. However we all have colds, and I was home sick yesterday. But I feel the pressure mounting to get all this work done and release to the public ASAP. So, it’s very much about working efficiently now, successfully carrying out a chisel-strike project every day. Today it was formatting the crawl document. Tomorrow, it’s going to be implementing the Tweets, Likes and Pluses functions, which are now going to be a default feature of a crawl.