Skip to content

Instantly share code, notes, and snippets.

@eritbh
Last active January 5, 2019 08:17
Show Gist options
  • Save eritbh/eaada5ac9ef9c5a3b681b105b3ace9fc to your computer and use it in GitHub Desktop.
Save eritbh/eaada5ac9ef9c5a3b681b105b3ace9fc to your computer and use it in GitHub Desktop.
Move moderator applications from a CSV generated from a Google Forms response sheet to individual comments on a submission.
import csv
import praw
import re
r = praw.Reddit(client_id="",client_secret="",username="",password="",user_agent="")
submission = r.submission(id="")
with open("file.csv", "r", encoding="utf-8") as file:
apps_reader = csv.reader(file)
for i, row in enumerate(apps_reader):
if i == 0:
headings = row
continue
text = ""
for j, col in enumerate(row):
content = " " + re.sub("\n", "\n ", col)
text += f"# {headings[j]}\n\n{content}\n\n"
print(text)
submission.reply(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment