Section 2. The Constitution is based on the indissoluble unity of the Spanish Nation, the common and indivisible homeland of all Spaniards
https://en.m.wikipedia.org/wiki/Spanish_Constitution_of_1978
Aiding and abetting a crime is also a crime. "Just" giving a list of addresses of, say, brothels is a crime in a jurisdiction where prostitution is illegal.
Yes, it's bananas that the central Spanish government has this reaction, but it's a perfectly correct and legal reaction, and this is part and parcel of the idea that Google should abide by the law in the countries where it operates.
From a distance it seems that it would have been preferable to let the referendum go ahead with as little fanfare as possible, but make clear that it's outcome has no legal status whatsoever, but then again, I'm not in the hot seat, representing a national constituency that's overwhelmingly against independence.