Yes you can (I've got one), there are various window seals to adapt to that or you can dyi too. The noise etc make it a temporary solution at best but it's possible.
I've also used portable AC inside my home, it was horrible, a lot of heat creeps in due to bad insulation for the heat exhaust pipe, also creates vacuum since it exhaust air, which in turn sucks in more hot air