Using a wish spell you can duplicate any other spell of 8th level or lower.
However..
That's a pretty high lv spell for gaining the use of a 1-5 level Ranger spell.
I couldn't find a version of limited wish. And the feat Magic Initiate doesn't seem to apply to Ranger's spells.
Is there another way to cast 1 or 2 Ranger spells without dipping into the Ranger class? Specifically I am looking at Conjure Barrage and Swift Quiver. Mostly because I think it would be cool to launch a ton of darts like a Naruto style Ninja…and it would be unexpected from my wizard.
Worth noting we only use the hardcover books. No UA or 3rd party stuff please.
Best Answer
DMG pg 285. Emphasis mine
So with your DM's permission, a wizard could have easy access to the ranger spells you want, with little or no change to balance