This will only work if your vehicle is unlocked, however! If your car is locked, your fuel door will lock too. This protects your car from fuel siphoning, gas tank tampering, and other such issues.
If you run into any issues opening your gas tank in this manner, it’s best to consult a mechanic. The problem could be electrical in nature, since it may be that the lock on your fuel tank won’t unlock properly.