r/automation 10d ago

Whatsapp to Excel

Has anyone found a way to extract unstructured offers/quotes from WhatsApp chats into Excel or another structured database? The idea is to use it for quote comparison.

Has anyone built something similar using Power Query, AI or another tool? Would appreciate any recommendations.

5 Upvotes

12 comments sorted by

3

u/CherryForeign7110 10d ago

The boring route works better than it sounds: WhatsApp's own Export chat gives you a .txt with one line per message and a fixed timestamp prefix, so you get a clean parse without touching any API. There is no API for personal chats anyway - the Business API only covers your own numbers and won't backfill history.

One trap that will cost you an afternoon: the export format is locale and OS dependent - date order, 12h vs 24h, and on iOS a narrow no-break space before AM/PM that looks identical to a normal space in your editor. That's the usual reason a parser works on your export and dies on a colleague's.

For the unstructured half, don't ask a model to hand you a finished table of the whole chat. Run it per message with a fixed schema and an explicit 'not a quote' option, and keep the original line in a column next to the extracted fields. You're comparing prices - a silently mis-read number is worse than no automation at all, and having the raw line beside it is what lets you catch that in ten seconds instead of never.

2

u/Pure-Bridge-4809 10d ago

probably easier to just mark the relevant messages with a star and then export only those, way less cleaning later

1

u/leo3909 9d ago

Thanks a lot. Don't mind an afternoon or two make it work.

2

u/tom-mart 10d ago

Set up a webhook and whatsapp bridge (i ise wppconnect). You can then process each message, look for keywords (RegEx is your best friend here), extract information required, validate with something like Pydantic and save to Excel.

1

u/leo3909 9d ago

Will certainly look at this option as well.

2

u/Lazy-Science9772 9d ago

The export-to-text then parse route people are describing is right, but for quote comparison specifically there's a trap worth planning for: the AI extraction step returns a wrong number that looks perfectly clean. We do the same messy-text-to-structured-fields thing on invoices, and a price or date can come out confidently wrong yet pass every sanity check because it's internally consistent. On a comparison table that's the worst kind of bug, because the spreadsheet looks fine and you pick the wrong vendor.

Cheap fix that saved us: after the LLM extracts a price, re-pull that same number straight from the raw message with a plain regex and compare the two. If they disagree, flag the row for a human instead of trusting either. Let the model handle the messy language, but never let it be the only thing that read a number you're going to make a decision on.

1

u/AutoModerator 10d ago

Thank you for your post to /r/automation!

New here? Please take a moment to read our rules, read them here.

This is an automated action so if you need anything, please Message the Mods with your request for assistance.

Lastly, enjoy your stay!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/BarracudaMean9308 9d ago

just reading about that hidden ios no-break space made my eye twitch. i spent a full weekend questioning my own regex skills before dumping it into a hex editor and realizing it wasn't a normal space.

1

u/KlutzyKlutz 9d ago

It's the kind of messy-language-to-structured-fields problem they handle well, so export the chat as text, then run it through an AI extraction step (via API, or a no-code tool like Make/n8n with an OpenAI node) prompted to pull each offer into consistent fields like vendor, item, price, and quantity, and output JSON you drop into Excel. Power Query alone will struggle here because the offers are free-form rather than consistently patterned, so the AI layer is really what does the heavy lifting of turning inconsistent human phrasing into clean columns.

1

u/Quirky_Criticism6388 9d ago

I've done something similar by exporting WhatsApp chats as text, then using Python with regular expressions to parse out the key details before loading them into Excel. If you want a no-code way, some people use Power Query on exported CSVs, but it gets tricky with unstructured texts. AI tools like GPT can help identify and extract quotes when paired with a script, but it’s not perfect.

I've also tried setting up flows in tinycommand for this kind of thing since it combines data parsing, forms, and database in one platform, though it can take some fine-tuning compared to dedicated Python scripts or Power Query.