- Log in to Zomato in your browser
- Go to order hostory page
- Click
Load More
as many times as you want. You can go back as far as you want. ( maybe I'll add this functionality in the script later) - Right click any item > Inspect
- paste the contents of
gluttony.js
into the console and run it - You'll see a csv in your downloads when it's done.
Last active
September 22, 2024 10:43
-
-
Save vyashole/8dbbd909943d96486857dfd5bb539ba2 to your computer and use it in GitHub Desktop.
Gluttony - Zomato Order History Export
This file contains 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
var results = [] | |
$('.order-history-snippet').each(function() { | |
from = $(this).find('.col-l-16 .w100 .mtop0 .ui .item .content .header .left').text().trim() | |
status = $(this).find('.col-l-16 .w100 .mtop0 .ui .item .right b').text().trim() | |
orderNumber = $(this).find('.order-number').text().split(':')[1].trim() | |
cost = $(this).find('.cost b').text().trim().replace('₹', '') // comment the replace part if you want the ₹ symbol in the sheet. | |
//LibreOffice was having a hard time applying formulas to values with the symbol | |
date = $(this).find('.ui.basic.label').text().trim() | |
results.push({ | |
date, orderNumber, from, cost, status | |
}) | |
}); | |
var fields = Object.keys(results[0]) | |
var csv = results.map(function(row){ | |
return fields.map(function(fieldName){ | |
return JSON.stringify(row[fieldName]) | |
}).join(',') | |
}) | |
csv.unshift(fields.join(',')) | |
text = csv.join('\r\n') | |
console.log(text) | |
var element = document.createElement('a'); | |
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); | |
element.setAttribute('download', 'export.csv'); | |
element.style.display = 'none'; | |
document.body.appendChild(element); | |
element.click(); | |
document.body.removeChild(element); |
Hey Adwait, I am doing a visualization project and need to use this code to export my order history. This code would help me so much by solving my problem, but i am facing issue while running it in console.
Getting the error:
Uncaught TypeError: Cannot read property 'each' of null
Hey, I don't think this script works anymore. It relied on the layout that zomato website used back in February 2019 lol.
The site has changed so much since then
Yep, this no longer works, instead you have a paginated view and most of the information is hidden in the cards.
Let me work on it and fix this thing.
Let me work on it and fix this thing.
So does it work now
order history page has been removed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Super neat! 👍
Wanted to check how much money I've spent on orders :P