Model: „Es tut mir leid, dass [Problem]. Ich konnte nicht [Infinitiv], weil [Grund].“ Use this for friends; in a formal note, add „Bitte entschuldigen Sie …“.