APK xətaları

WhatsApp söhbəti Excel-də ə hərfi pozulur

Azərbaycan telefonundan çıxan söhbət belə bir sətirdir: 12.10.2026, 14:05 - Əli: salam. Fayl UTF-8-dir. Excel onu iki dəfə basanda sistem cədvəli ilə açır. Orada ə yoxdur, hərf ? və ya başqa işarə olur.

.txt faylını Excel-ə birbaşa açma. Əvvəl CSV yaz və əvvəlində BOM qoy.

from pathlib import Path
import csv

text = Path("sohbet.txt").read_text(encoding="utf-8")
rows = []
for line in text.splitlines():
    if " - " not in line or ": " not in line:
        continue
    left, message = line.split(": ", 1)
    when, name = left.split(" - ", 1)
    rows.append((when, name, message))

with open("sohbet.csv", "w", newline="", encoding="utf-8-sig") as fayl:
    writer = csv.writer(fayl)
    writer.writerow(["tarix", "ad", "mesaj"])
    writer.writerows(rows)