Last active
October 10, 2021 05:22
-
-
Save rdegges/421acae378d7d05e6c6be560eb1b4ff5 to your computer and use it in GitHub Desktop.
Small Python hack to purge Google Contacts of any contacts without a phone number.
This file contains hidden or 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
# for context: https://twitter.com/rdegges/status/1447066985213292544?s=20 | |
import csv | |
ORIG_FILE = 'contacts.csv' | |
NEW_FILE = 'contacts-clean.csv' | |
PHONE_NUMBER_INDEX = 41 | |
with open(NEW_FILE, 'w', newline='\n') as wfile: | |
writer = csv.writer(wfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) | |
with open(ORIG_FILE) as rfile: | |
reader = csv.reader(rfile, delimiter=',', quotechar='"') | |
for row in reader: | |
x = row[PHONE_NUMBER_INDEX] | |
if x: | |
writer.writerow(row) | |
print(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment