Skip to content

Daily

Export Discord members with a role to Google Sheets

A sheet listing every member of your Discord server who has a chosen role, refreshed each day.

Runs
Daily
Apps
Discord, Google Sheets
AI
Not needed
Access
Discord bot with Server Members intent; Sheets edit

Send this to your assistant

Create a ClickRuntime automation: every day, list all members of my Discord server with the Subscriber role and write them to my Members sheet.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A creator runs a paid community on Discord where supporters get a Subscriber role. To send perks, check who is still subscribed, or compare against the payment platform, she needs a list of who has the role. Discord shows it only by scrolling through the member list, and copying a few hundred names by hand takes an evening and is out of date the next day.

A daily refreshed sheet turns the role into a list you can sort, filter, share and match against other records, without anyone touching the Discord member list.

What you get out of it

  • A list you can actually work with

    A sheet can be filtered, sorted and searched in ways the Discord member list cannot. It is ready for mail merges, perk deliveries and quick counts.

  • Always up to date

    The sheet is rewritten every day, so people who gained or lost the role are reflected by the next morning. You never work from a stale export.

  • Easy to check against payments

    Comparing the sheet with your billing list shows who has the role but is no longer paying, and who paid but never got the role. Both are easy to fix once you can see them.

  • Share without giving server access

    A moderator or assistant can be given the sheet without admin rights in Discord. They get the information they need and nothing more.

  • No hand copying

    Nobody scrolls through hundreds of members writing down names. The time goes to the community instead.

How it works

What happens, step by step

  1. Every day, ClickRuntime looks up the role you chose in your Discord server.

  2. It reads through every member of the server and keeps the ones who have that role.

  3. It clears the sheet and writes the current list, one member per row.

  4. If anything goes wrong, such as the bot losing access, you get an email.

Before it runs live

  • Connect Discord
  • Connect your Google Sheets account and pick the spreadsheets it may use

What you get

RunsDaily
Export Discord members with a role to Google Sheetstoday, 9:00Succeeded
Google Sheets · Members418 members with the Subscriber role, updated this morning

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Run it at a different time, more or less often, or only on weekdays
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other Discord and Google Sheets steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
export_discord_members_with_a_role_to_a_sheet.pyexample
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, notify

GUILD_ID = "your-server-id"
ROLE_NAME = "Subscriber"
SHEET_ID = "your-spreadsheet-id"

@on_trigger
def run(event):
    api = "https://discord.com/api/v10"
    h = {"Authorization": f"Bot {credentials.secret('DISCORD_BOT_TOKEN')}"}
    try:
        role = next(r["id"] for r in http.get(f"{api}/guilds/{GUILD_ID}/roles", headers=h).json() if r["name"] == ROLE_NAME)
        rows, after = [], "0"
        while True:
            page = http.get(f"{api}/guilds/{GUILD_ID}/members", headers=h, params={"limit": 1000, "after": after}).json()
            rows += [[m["user"]["id"], m["user"]["username"], m.get("nick") or m["user"].get("global_name") or "", m["joined_at"][:10]] for m in page if role in m["roles"]]
            if len(page) < 1000:
                break
            after = page[-1]["user"]["id"]
    except Exception as e:
        notify.email_me("Discord member export failed", str(e))
        raise
    sheets = build("sheets", "v4", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
    sheets.spreadsheets().values().clear(spreadsheetId=SHEET_ID, range="Members!A2:D").execute()
    sheets.spreadsheets().values().update(spreadsheetId=SHEET_ID, range="Members!A2", valueInputOption="RAW", body={"values": rows}).execute()
    return {"members": len(rows)}

FAQ

Common questions

Does the bot need special permissions?
The bot must be in your server and have the Server Members intent turned on in the Discord developer portal. Without it Discord does not let bots list members.
What columns does the sheet get?
Each row has the member's user ID, username, display name and the date they joined the server. User IDs stay the same even if someone changes their name.
Does it handle large servers?
Yes. Members are read in pages of 1,000 until the whole server has been checked, so servers with many thousands of members work the same way.
What permissions does it need?
Discord bot with Server Members intent; Sheets edit. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it runs (daily). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Export Discord members with a role to Google Sheets” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.