I have one requirement to generate Pivot in XLS from Postgre SQL query. Here's my requirement

My table has the below columns

Region RSO Office Rep Name Premium
REGION1 300
RSO
OFFICE
REP1 100
REP2 100
REP3 100

Can some one help me to write a query to generate Pivot ?