Ismail bin Abdullah bin Jafar reported,

It has reached me that the Messenger of Allah ﷺ said, "There is no person who sits in a gathering and then says, when he intends to rise, 'Glory be to You, O Allah, and praise be to You. There is no god but You. I seek Your forgiveness and turn to You in repentance,' except that he is forgiven for whatever occurred in that gathering."

Azami 10789

Sahih

عن إسماعيل بن عبد الله بن جعفر قال

بلغني أن رسول الله ﷺ قال: ما من إنسان يكون في مجلس فيقول حين يريد أن يقوم: سبحانك اللهم وبحمدك لا إله إلا أنت، أستغفرك، وأتوب إليك إلا غفر له ما كان في ذلك المجلس.

الأعظمي 10789صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Supplications, remembrances, and prayer upon the chosen Prophet ﷺ
Chapter
Supplications
Section
What to say when getting up from one's gathering
Numbering
Jami al-Kamil 10789 (2nd edition)
Azami 10789