Exporting Rabona teams into EXCEL files

in STEMGeekslast year (edited)

The team page on Rabona doesn't let you filter/sort players by their properties. I've needed that functionality to plan my next season's roaster, so I have decided to hack a quick script to get the data and export it to excel (.xlsx format)

import pandas as pd
from rabona_python import RabonaClient


    PLAYER_TYPE_GOAL_KEEPER: "goal keeper",
    PLAYER_TYPE_DEFENDER: "defender",
    PLAYER_TYPE_MIDFIELDER: "midfielder",
    PLAYER_TYPE_ATTACKER: "attacker",

def get_players(username):
    # https://api.rabona.io/team?user=emrebeyler
    rabona_client = RabonaClient()
    players = rabona_client.team(user=username)
    return players

def normalize_players(players):
    normalized_players = []
    for player in players:
        # human readable type
        player["position"] = PLAYER_TYPE_MAP.get(player["type"])
        player["OS"] = player["overall_strength"]
        player["GK"] = player["goalkeeping"]
        player["TP"] = player["teamplayer"]
        # not needed
        del player["type"]
        del player["ask_id"]
        del player["teamplayer"]
        del player["goalkeeping"]


    return normalized_players

def main(username):
    players = normalize_players(get_players(username)["players"])

    df = pd.DataFrame(players, columns=[


    df.to_excel(f"players_{username}.xlsx", header=True)


Just update the first argument in the main function with your username and let the script run. A new file (players_{username} will be created on the script's directory.) You need Python3, pandas, and rabona_python libraries.


I might transform this into a small web app so that you can download the same excel without knowing any scripting spells. Just let me know if that would be something useful for you.

Posted with STEMGeeks


Seems like every time I turn around lately I keep think I am in deep water trying to learn a little python 3 programming. Another aspect to look into the panda stuff. I wonder where it will all end, still fun trying to get out of the driveway. One day I may make it to the street.

Great! Thank you!

Command accepted!


Awesome! (:

"I might transform this into a small web app so that you can download the same excel without knowing any scripting spells."

That would be pretty cool.

will build something very quick

Nice one buddy and congrats to your win in the night - I only struggle with this:

You need Python3, pandas, and rabona_python libraries.

will release a small web app to get the data, wait a little bit :)

Great dude

Very handy!

Aeneas is a blockchain project under development and a decentralized blogging platform based on Hive spesialized on the #social #politics #economics #indiejournalizm and all the #cryptocurrency related threads
Join Aeneas.Blog to earn more ASH for your unique content!
Dear, @emrebeyler, you have received ASH tokens!
Join our Discord Server for further updates!

 last year Reveal Comment