I know to say to a person how old they are you can say "你多大" or "你几岁". But, how could you express "how old is this building?"
Would you say "这楼有几年的历史？" Or would that only be used for something grand like 故宫?
You're correct that 历史 is too splendid a word for an ordinary office building. Besides, you cannot put it together with 几年 without humor, because the question word 几 usually stands for a small, namely one digit number. (几十年 or 几百年 is acceptable.)
(EDIT: It's a universal fact in Mandarin that you should use 多少 for asking a truly indeterminate number of anything.)
"How old is this building?" would be:
这楼盖了有（多久／多少年）了？ (How / How many years) old is this building since it's been built?
(EDIT #2-1: 有多少年 doesn't seem as much approvable as 有多久. In fact, none of them exactly mean "how old (a thing) is". The former is "how many years it has", and the latter, "how much time lapse it has". Using the former alone has a risk to meet with "How many years of what?" kind of response, depending on the context. At least, I prefer this to that, and moreover prefer the second example to the first.)
But I can also imagine I'd ask:
这楼多少年盖的？In what year was this building built? (See better solution in 杨以轩's answer)
这楼什么时候盖的？ When was this building built?
(EDIT #2-2: Here you can see that I ran into another difficulty since Chinese doesn't really have a casual question word exactly equivalent to "what year". In this sense, 杨以轩's choice is far better than mine, and what is more, he seems to be a realtor.)
In addition to broccoli forest's answer, you may use 屋龄[wū líng] to refer to the age of a building.
What's the age of this building?
Is buying an old house and renovating extensively better, compared to buying a brand new house?
If you want to inquire about the exact year, you can use 年份 to get yourself understood:
Which year was this building constructed?