Created
May 20, 2022 14:34
-
-
Save toloco/f1686aebafb2324ec140f3c6d3ed7dfd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import csv | |
import argparse | |
TRANSLATION = { | |
"First Name": "First Name", | |
"Last Name": "Last Name", | |
"Company": "Current Company", | |
"Title": "Current Title", | |
"Notes": "", | |
"Email": "Email Address", | |
"Phone": "Phone Number", | |
"Social Media": "", | |
"Website": "Profile URL", | |
"Address": "", | |
"Source": "Linkedin prospecting", | |
"Who gets credit": "", | |
"Job": "", | |
"Department": "", | |
"Office": "", | |
"Prospect Pool": "", | |
"Prospect Stage": "", | |
} | |
def parse_row(row, recruiter: str): | |
new_row = {k: row.get(v, v) for k, v in TRANSLATION.items()} | |
new_row["Who gets credit"] = recruiter | |
return new_row | |
def main(input, recruiter): | |
with open(input, newline="") as input_f, open(f"green-{input}", "w") as output_f: | |
reader = csv.DictReader(input_f) | |
writer = csv.DictWriter( | |
output_f, TRANSLATION.keys(), quotechar='"', quoting=csv.QUOTE_ALL | |
) | |
writer.writeheader() | |
for row in reader: | |
writer.writerow(parse_row(row, recruiter)) | |
def parse_args(): | |
parser = argparse.ArgumentParser(description="Convert Linkedin csv to Greenhouse") | |
parser.add_argument("input", metavar="N", type=str) | |
parser.add_argument("--recruiter", type=str, default="Yuliia Syrotiuk") | |
return parser.parse_args() | |
if __name__ == "__main__": | |
args = parse_args() | |
recruiter = args.recruiter | |
print(f"Converting {args.input} to Greenhouse format") | |
main(input=args.input, recruiter=args.recruiter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment