I've been going to the gym for a few years but now I'm tired of going. I get depressed because I don't go and depressed thinking of going. Any advice?

Go but... Vigorous physical activity is good for mental health and many people who stop working out get depressed --- including about working out. Push yourself to go back to the gym --- "just do it" but try out new things. If you have been doing weight training join an aerobics class, switch from free weights to machines or vice versa, swim, or get a trainer. Doing the same thing for years can get you down.
Gym. Have you tried the buddy system? Sometimes when people depend on each other to go to the gym it offers incentive different from going alone.
Find a counselor. Talk about the problem, discover the two sides to this problem and then resolve the issue.