Created
September 8, 2025 19:56
-
-
Save byronferguson/b42591914b29c074b81d2f582e7958c5 to your computer and use it in GitHub Desktop.
Simple script to transform the Dreamborn.ink Export CSV into the Bulk Add CSV
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
import csv | |
import os | |
input_file = "input.csv" | |
output_file = "output.csv" | |
input_path = os.path.join(os.path.dirname(__file__), input_file) | |
output_path = os.path.join(os.path.dirname(__file__), output_file) | |
with open(input_path, newline='', encoding='utf-8') as infile, open(output_path, 'w', newline='', encoding='utf-8') as outfile: | |
reader = csv.DictReader(infile) | |
writer = csv.DictWriter(outfile, fieldnames=["Set Number", "Card Number", "Variant", "Count"]) | |
writer.writeheader() | |
for row in reader: | |
# Normal variant | |
normal_count = int(row["Normal"]) | |
if normal_count > 0: | |
writer.writerow({ | |
"Set Number": row["Set Number"], | |
"Card Number": row["Card Number"], | |
"Variant": "normal", | |
"Count": normal_count | |
}) | |
# Foil variant | |
foil_count = int(row["Foil"]) | |
if foil_count > 0: | |
writer.writerow({ | |
"Set Number": row["Set Number"], | |
"Card Number": row["Card Number"], | |
"Variant": "foil", | |
"Count": foil_count | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment