- 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
December 1, 2024 05:01
-
-
Save vyashole/8dbbd909943d96486857dfd5bb539ba2 to your computer and use it in GitHub Desktop.
Gluttony - Zomato Order History Export
This file contains hidden or 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); |
I have created a new solution for it
https://gist.github.com/Dev-Dipesh/65fe40f16acdd806eaa0355ac518dc7c
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
order history page has been removed