Profile

  • Guest
    0
  • Posts: 21
  • Post Likes: 3765

Notifications

  • No Unread Notifications

Solved
about CSV

This thread is closed because it is solved.
1
This topic has been closed by the moderator
5419
3 years 310 days ago
I want you to separate the driver name and team name in the race result exported by CSV.
5610 Moderator
3 years 310 days ago (Last edited by M. Truche 3 years 310 days ago)
Hi Makoto,

Just a copy/paste of a tip I had posted on the forum. Maybe not the perfect solution, but it works.

Don't know if it can help you, but here a small trick to split drivers / teams to download a well formated CSV.


  1. In your web browser, create a new bookmark (favorite)

  2. Fill the address/URL field of this bookmark with the snippet of Javascript (see below)

  3. To use it, go on the race result and open your bookmark (the table will be update and you can use the Export CSV button)



Javascript function (last update 20/07 20h05) :
javascript:(function()%7Bvar%20k=document.getElementById("csvRace");fix=$(k).html().replace(/<br>/g,'<td>').trim();$(k).html(fix);hder=k.getElementsByTagName('th')[1];hder.insertAdjacentHTML('afterend','<th>Team</th>');document.getElementsByClassName("gold")[0].textContent=1;document.getElementsByClassName("silver")[0].textContent=2;document.getElementsByClassName("bronze")[0].textContent=3;%7D)();



Example :



5419
3 years 310 days ago
I tried this on Chrome for Mac but it didn't work.
5000
3 years 310 days ago
This would be useful but I can't get it to work, I am using office 2019. Not sure I follow you on the bookmark part.
5114
3 years 310 days ago
Archibald
This would be useful but I can't get it to work, I am using office 2019. Not sure I follow you on the bookmark part.

That is done in the web browser, not in Office.


Paste the following in the search bar:

javascript:(function()%7Bvar%20k=document.getElementById("csvRace");fix=$(k).html().replace(/ /g,',').replace(/<br>/g,'<td>').trim();$(k).html(fix);hder=k.getElementsByTagName('th')[1];hder.insertAdjacentHTML('afterend','<th>Team</th>');document.getElementsByClassName("gold")[0].textContent=1;document.getElementsByClassName("silver")[0].textContent=2;document.getElementsByClassName("bronze")[0].textContent=3;%7D)();


5000
3 years 310 days ago
Still no luck never mind. Thanks for the effort though.
5610 Moderator
3 years 310 days ago
Makoto
I tried this on Chrome for Mac but it didn't work.


My bad, I did not see the HTML table had changed. I have updated the Javascript function to solve the issue.


Let's try to explain how to use it :


  • Firefox



  1. Open Firefox

  2. Ctrl B (to open bookmarks view)

  3. Right click

  4. Add a bookmark

  5. Name : iGP CSV (does not matter)

  6. URL : copy/paste the javascript function posted below

  7. Save




  • Chrome



  1. Open Chrome

  2. Ctrl Shift O (to open bookmarks view)

  3. Right click

  4. Add new bookmark

  5. Name : iGP CSV (does not matter)

  6. URL: copy/paste the javascript function posted below

  7. Save



New Javascript function :
javascript:(function()%7Bvar%20k=document.getElementById("csvRace");fix=$(k).html().replace(/<br>/g,'<td>').trim();$(k).html(fix);hder=k.getElementsByTagName('th')[1];hder.insertAdjacentHTML('afterend','<th>Team</th>');document.getElementsByClassName("gold")[0].textContent=1;document.getElementsByClassName("silver")[0].textContent=2;document.getElementsByClassName("bronze")[0].textContent=3;%7D)();



Now, go to the results page you wanted to dowload as CSV.
Click on the "iGP CSV" bookmark. A new column with team name should be visible in the table.
Download CSV file as usual.
5000
3 years 310 days ago
Now working fine, good job. Thanks
5419
3 years 310 days ago
I did it well! This is useful! Thank you very much!
This topic has been closed by the moderator
1

You must be logged in to post a reply.