expression
Polite past-tense expression of gratitude, used after someone has done something for you. More formal than ありがとうございます.
先日は大変お世話になり、有難うございました。
Thank you very much for all your help the other day.
ご来場いただき、ありがとうございました。
Thank you for coming.
Non-past polite form, used for ongoing or future gratitude. ありがとうございました is for past actions.
Casual form, used among friends or in informal situations.
From 有難う (ありがとう, 'thank you') + ございました, the polite past form of ござる ('to be'). Literally 'it was difficult to exist', expressing that the favor was rare and precious.