G Spread for a corporate bond

Let’s say I have a corporate bond with a 5 year maturity. 2 years have passed and I have only 3 years until maturity. If I wanted to calculate the G spread to the interpolated point on a government benchmark, do I calculate it from the most recently issued government bond with 3 year maturity? What if there isn’t a benchmark that matches the time until maturity.

Secondly, I am new to this but I have seen people calculate the spread to treasury in Bloomberg then override the spread value and then pull out the G spread. This is through the use of a YAS function. Why isn’t the spread parameter pulled out directly.