Can you get pregnant from having sex almost a week before ouvlation.?

Yes. If there is good cervical mucus it can act as a storage place for sperm. The sperm are released over several days and can cause surprise pregnancies for people using natural family planning.
Possibly. One study showed that pregnancy was possible if sex occurred up to 6 days before ovulation. Conversely, no one in the study got pregnant if sex occurred after ovulation.