Made the query for the excel generator