The chat export feature converts decrypted WhatsApp databases into portable formats including HTML, CSV, JSON, and TXT. It supports fuzzy search for finding chats, exports all chats or specific conversations, and includes intelligent media linking for HTML exports.
dbs = []if os.path.exists("backups"): for root, _, files in os.walk("backups"): for f in files: if f.endswith('.decrypted.db'): dbs.append(os.path.join(root, f))if not dbs: ui.print_warning("No decrypted databases found.") returnrows = []for i, p in enumerate(dbs): t = "WhatsApp" if "messenger" in p.lower() else "Business" if "business" in p.lower() else "Unknown" rows.append([str(i+1), t, os.path.basename(p)])ui.print_table("Select Database to Export From", ["#", "Type", "File"], rows)
Export operates independently of the viewer, allowing exports without loading the database in the viewer first.
For single chat exports, the tool provides intelligent search:
if c == '2': search = ui.ask("Search chat (name/jid) - Leave empty to list all") all_chats = export_viewer.list_chats(0) if not search or not search.strip(): chats = all_chats else: search = search.lower().strip() # Intelligent Search using Fuzzy Matching if process: # thefuzz library available # Create lookup dictionary choices = {f"{c['subject']} {c['jid']}": c for c in all_chats} # Get top matches results = process.extract( search, choices.keys(), limit=50, scorer=fuzz.partial_token_sort_ratio ) # Filter by score threshold chats = [choices[res[0]] for res in results if res[1] > 40] ui.print_info(f"Found {len(chats)} matches for '{search}' (Fuzzy Search)") else: # Fallback to simple substring chats = [ x for x in all_chats if (x['subject'] and search in x['subject'].lower()) or (x['jid'] and search in x['jid'].lower()) ]
Fuzzy matching allows finding “John Doe” by searching “john”, “doe”, or even “jhn” with typo tolerance.
with ui.spinner("Exporting..."): if fmt == '5': # All formats for f in ['html','csv','json','txt']: export_viewer.export_chats(out, f, cid) else: f = {'1':'html','2':'csv','3':'json','4':'txt'}.get(fmt,'html') export_viewer.export_chats(out, f, cid)self.session_stats["exports"] += 1
The thefuzz library is optional. If not installed, the tool falls back to substring matching. Install with pip install thefuzz for better search results.
Media not showing in HTML
Ensure media was extracted during backup dump
Check that the Media folder exists at ../Media/ relative to the HTML file
Media paths must match the database references
Some media may have been deleted from the device
Export takes a long time
Exporting all chats with thousands of messages can take time. Consider:
Exporting individual chats instead of all at once
Using simpler formats (TXT/CSV) instead of HTML
Being patient with large databases (100k+ messages)
Special characters corrupted
Ensure your text editor or spreadsheet program supports UTF-8 encoding. All exports use UTF-8 to preserve emojis and international characters.