I made a major update to the Google Docs Writing Tracker today. Although the update does not introduce any new features, it does bring the code up to the current standards for Google App Scripts. Back in December, Google deprecated a big portion of its Google DocsList code in favor of the DriveApp code.
The Google Docs Writing Tracker referenced the old code in dozens of places. Today, I replaced those old references with references to the newer DriveApp object model. This means that if you are using the new code, you should no longer see any messages about deprecated code in the execution logs.
The only significant change, from a user-perspective, is how folders are handled in the Config tab of the spreadsheet. For now, I did the simplest possible implementation. The values for the Sandbox and Snapshot folders should refer directly to the folder name and not include the path. So if you used to do something like this:
You should change it to do this instead:
This looks for the idea of the folders named above, and uses their ID instead of their name throughout the scripts. It does mean it will cause problems if you have more than one folder with the same name, but it is good enough for now.
One small bug fix
Included in this refactor is a minor bug fix. Some people have reported no data all of a sudden, after the code has been working for a long time. The problem, it turned out, was happening with people using the RescueTime integration. If, for some reason, RescueTime could not by reached by the API call, the JSON file returned was empty. This wasn’t handled properly by the scripts.
Now, it is.
So if you use RescueTime integration and the API call fails for some reason, it won’t break the rest of the script from running. You just won’t have RescueTime data for that day.
Getting the new version
To avoid confusion in the short term. I have checked the new code into a separate branch in the GitHub project. If you want the new code, pull the google-drive-refactor branch. If you want to see how much of the code actually changed, check out the differences.
I’ve done some testing on my own machine and it seems to work okay. When I feel that enough general testing has been done, I’ll merge this code into the master. If you find any problems, open up an issue.
More coming soon
I’m also working on a new feature that I’ve wanted for a while now: Project Tracking. This allows you to assign arbitrary project names to documents. The words counts are tracked daily by project on a separate sheet in the workbook, allowing you to track words and time by project, as well as by day. Especially useful if you work on multiple projects in a day (as I sometimes do) or have multiple documents in a project (as I do when I work on novels).
And as always, if you have suggestions, let me hear about them. Or better yet, fork the code and try to implement them yourself.