Skip to content

Instantly share code, notes, and snippets.

@owenversteeg
Last active January 3, 2016 01:59
Show Gist options
  • Save owenversteeg/8392822 to your computer and use it in GitHub Desktop.
Save owenversteeg/8392822 to your computer and use it in GitHub Desktop.
Bookmarklet for collecting Google Docs contributor data into .tsv format. In order to use it, you must first expand the contributor list (and then run this in the console.) You can modify the call to console.log if you want the data to be alerted. (Of course, you can't copy the data unless it's console.logged.)
javascript:function getCollaboratorDetails() { var collaboratorsElements = document.getElementsByClassName('docs-revisions-tile-collaborator'); var collaborators = []; var returnText = "Name\tContributions\n";for (var i=0; i<collaboratorsElements.length; i++) { collaborators[collaboratorsElements[i].innerText] = (collaborators[collaboratorsElements[i].innerText]+1 || 1); } console.log(Object.keys(collaborators)); for (var i=0; i<Object.keys(collaborators).length; i++) { returnText += Object.keys(collaborators)[i] + "\t" + collaborators[Object.keys(collaborators)[i]] + "\n" } return returnText; } console.log(getCollaboratorDetails());
@owenversteeg
Copy link
Author

If anyone's curious, it's TSV because gdocs doesn't accept copy/paste in CSV. It can be CSV if you just modify the
"\t"s to ","s.

@owenversteeg
Copy link
Author

I also apologize for the horrible code quality; it was my first priority to get something working when I wrote this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment