Skip to content

Instantly share code, notes, and snippets.

@kkroesch
Last active January 15, 2026 19:24
Show Gist options
  • Select an option

  • Save kkroesch/a6d70b290e39673e35c0c1da1493c6ba to your computer and use it in GitHub Desktop.

Select an option

Save kkroesch/a6d70b290e39673e35c0c1da1493c6ba to your computer and use it in GitHub Desktop.
Convert repaterbook.com exported CSV to Icom ID-52E import format.
import csv
def format_freq(value):
# Wandelt Punkt-Dezimal in Komma-Dezimal mit 6 Stellen um
try:
f = float(value)
return "{:.6f}".format(f).replace('.', ',')
except:
return "0,000000"
def convert():
input_file = 'normal.csv'
output_file = 'ID52_MEMORY.csv'
with open(input_file, 'r', encoding='utf-8') as f_in:
reader = csv.DictReader(f_in)
with open(output_file, 'w', encoding='utf-16', newline='') as f_out:
# Wir schreiben manuell, um volle Kontrolle über die Semikolons zu haben
f_out.write("TYPE;MEMORY CH\r\n")
headers = [
"Group No", "Group Name", "CH No", "Name", "Frequency", "Dup",
"Offset", "TS", "Mode", "SKIP", "TONE", "Repeater Tone",
"TSQL Frequency", "DTCS Code", "DTCS Polarity", "DV SQL",
"DV CSQL Code", "Your Call Sign", "RPT1 Call Sign", "RPT2 Call Sign"
]
f_out.write(";".join(headers) + "\r\n")
for i, row in enumerate(reader):
try:
out_f = float(row['Output Freq'])
in_f = float(row['Input Freq'])
# Name aus Call und Location (max 16 Zeichen)
name = f"{row['Call']} {row['Location']}".replace('"', '')[:16].strip()
# Duplex Logik
dup = "OFF"
offset = 0.6
if in_f < out_f:
dup = "DUP-"
offset = out_f - in_f
elif in_f > out_f:
dup = "DUP+"
offset = in_f - out_f
# Tone Handling
u_tone = row['Uplink Tone'].strip()
tone_val = f"{u_tone}Hz".replace('.', ',') if u_tone else "71,9Hz"
has_tone = "TONE" if u_tone else "OFF"
# Zeile zusammenbauen
line_data = [
"00", # Group No
"", # Group Name
"{:02d}".format(i), # CH No
name, # Name
format_freq(out_f), # Frequency
dup, # Dup
format_freq(offset), # Offset
"12,5kHz", # TS (Tuning Step)
"DV" if "Digital" in row['Modes'] else "FM",
"OFF", # SKIP
has_tone, # TONE
tone_val, # Repeater Tone
"88,5Hz", # TSQL Frequency (Default)
"023", # DTCS Code
"BOTH N", # DTCS Polarity
"", "", "", "", "" # DV & Call-Sign Spalten
]
f_out.write(";".join(line_data) + "\r\n")
except (ValueError, KeyError):
continue
if __name__ == "__main__":
convert()
print("Konvertierung abgeschlossen.")
@kkroesch
Copy link
Author

Had to write this because of errors while exporting directly to Icom format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment