Ultrathin insulator films from first principles: a ground and excited-state perspective