Skip to content

Instantly share code, notes, and snippets.

@mahmut-gundogdu
Last active October 31, 2019 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mahmut-gundogdu/ebac0955ccfd8e2d5bfd56eb4b2caeaa to your computer and use it in GitHub Desktop.
Save mahmut-gundogdu/ebac0955ccfd8e2d5bfd56eb4b2caeaa to your computer and use it in GitHub Desktop.
moment.lang("tr")
var mainElement = $("#ctl00_ctl60_g_86ee7db6_7073_42c5_9737_7005e352da4c .container" )[0]
var result = [];
$(mainElement.children).each(function(a,b){
var row = []
$(b.children).each(function(x,y){
row.push(y.innerText)
});
var date = row[0].split(' ');
date.pop();
row[0] = moment(date.join(' '),'DD MMMM YYYY').format('DD-MM-YYYY');
if(row.length > 3)
row = [row[0],row[1],row[row.length - 1],...row.splice(1,row.length) ]
result.push(row.join(';'))
})
var csvContent = "data:text/csv;charset=utf-8,";
csvContent += "Tarih;Giris;Cikis\r\n"
csvContent += result.join('\r\n');
//console.log(csvContent)
var link = document.createElement("a");
link.setAttribute("href", csvContent);
link.setAttribute("download", "giris-cikis.csv");
document.body.appendChild(link); // Required for FF
link.click(); // This will download the data file named "giris-cikis.csv".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment