RSCRIPT - How to have the nearest gene for a thousand of rsid

Good morning,

I have a list of rsid with chromosome and position in GRCH37, I will like to allocate them to a single gene per rsid (ideally the nearest gene). How can I do it?

Please help

A.