Page MenuHomePhabricator

wishlisted: Wikidata Tools for Google Spreadsheets add-on
Closed, ResolvedPublic


@Tomayac has written an excellent add-on for Google Spreadsheets, Wikipedia Tools for Google Spreadsheets, which I use very intensively.

While using it, I have often thought how incredibly handy it would be to have a similar tool, but with Wikidata-focused commands - Wikidata Tools for Google Spreadsheets. Unfortunately I'm not a programmer so can't write this myself, but I would be extremely grateful to anyone who would build this.

Features that would be great to have:

  • Start from a cell with either a Wikidata Q number or an en:Article Title (or other language code)
  • Ability to retrieve the value of a specific property for that Q number or Wikipedia article link; either as a resulting Q number, or its label in a given language, or the string/whatever in case of (e.g.) time properties, identifiers, etc.

More suggestions welcome.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 20 2016, 12:15 PM

Hi @Spinster,

I believe what you envision is already possible with the latest version of the add-on. Please see the WIKIDATA* functions, namely WIKIDATAQID, WIKIDATAFACTS, WIKIDATALABELS in the documentation.


Hi Tom, thanks for the quick reply! I know and use these functions, I actually mean something different: give me the specific value(s) for one specific property/statement, rather than all statements as happens in WIKIDATAFACTS.

For instance, if I have a cell containing Q1282569, I'd like to ask specifically for the English-value label of its P109 property (profession), and then in a next cell to the right for instance its P569 (date of birth) and in another next cell its P570 (date of death).
Next row I might have another Q-number for which I'd also ask its P109, and then P569, P570, etc. Each cell requests one property specifically. I hope I'm making myself clear.

As this is very Wikidata-centric I thought about a separate add-on rather than integrated in the current Wikipedia-centered one, but maybe they can be integrated too.

@Spinster I think this is possible by working with native functions, check this example.

Thanks for the example! It is handy in case of single queries, but what about checking many values for many Wikidata items at once? I have created an actual example / use case of a dataset that I'm currently working with and that is a typical workflow for me. See the example here.

(I don't intend to burden you specifically with this request - I put this here on Phabricator in the hopes that other developers may see it too, and might be interested in looking into this!)

Thanks for the realworld example (I have created a copy
that I could edit). So, there is a solution for your column D
(=QUERY(WIKIDATALABEL(B2, "en"), "SELECT Col2")) and with a couple of
hops for your other columns, but I can see how this can be tedious. I
have created
and will work on this in the near to mid future :-)

I am now actively working on this and have just updated the GitHub issue accordingly:

Alright, this is now fully working. You can as of now say…

WIKIDATAFACTS("Q42", "all", "P106")

…to get all of Douglas Adams' occupations (i.e., P106). If you replace "all" with "first", you will just get the first occupation.

If you want several properties, pass them as an array like…

WIKIDATAFACTS("Q42", "all", {"P31"; "P106"})

To reflect the changes, I have renamed the add-on to "Wikipedia and Wikidata Tools for Google Spreadsheets" :-)

Tomayac closed this task as Resolved.Oct 29 2016, 1:01 PM
Tomayac claimed this task.

@Spinster I'm closing this task :-)

Great! Thank you so much :-)