We will build a database from the information contained in fifa website to get all the ratings, positions, age, nationality and club from all the players registered with Fifa.
Fifa website looks like this, website: “https://www.fifaindex.com/players/fifa20/1/”
###Exploring website with R Code
library(rvest)
## Warning: package 'rvest' was built under R version 3.6.2
## Loading required package: xml2
## Warning: package 'xml2' was built under R version 3.6.2
#jalo la pagina
pageNumber = 1 #son 656 paginas , la ultima tiene 12 jugadores
fifa <- read_html(paste("https://www.fifaindex.com/players/fifa20/",pageNumber,"/",sep = ""))
playerNumber = 3
playerHTML=(fifa %>% html_nodes(".table") %>% html_nodes("tbody") %>% html_nodes("tr"))[playerNumber]
#jalas la primera informacion
(playerHTML%>%html_nodes("td")%>%html_text())[3:7] #ovr/pot ; name ; positions ; age ; hits
## [1] "9494" "Lionel Messi" "RWSTCF" "33"
## [5] "679"
That information is extracted from inspecting the website. We are obtaining inside a table, tbody, and extracting tr. Inside tag tr, we are extracting all td tags. Specifically td #’s 3 - 7. In other words, we are extracting data from the following elements. (real view from inspecting website)
It’s noticeable that the first player starts at tr # 3. We can notice, that we just extracted Name, Position, Fifa Overall Rating, age, and Number of Times Player was visited (Hits). We also need the club and Nationality for the player. These can be found inside the attributes for the anchor tags.
playerAttributes= playerHTML%>%html_nodes("td")%>%html_nodes("a")%>%html_attrs()
playerAttributes
## [[1]]
## href title
## "/player/158023/lionel-messi/" "Lionel Messi FIFA 20"
## class
## "link-player"
##
## [[2]]
## href title
## "/players/?nationality=52" "Argentina"
## class
## "link-nation"
##
## [[3]]
## href title
## "/player/158023/lionel-messi/" "Lionel Messi FIFA 20"
## class
## "link-player"
##
## [[4]]
## href title class
## "/players/?position=23" "RW" "link-position"
##
## [[5]]
## href title class
## "/players/?position=25" "ST" "link-position"
##
## [[6]]
## href title class
## "/players/?position=21" "CF" "link-position"
##
## [[7]]
## href title
## "/team/241/fc-barcelona/" "FC Barcelona FIFA 20"
## class
## "link-team"
So, player attributes will provide Nationality in position [[2]][2], and club in posiiton [[lastPosition]][2]. Therefore, we can have all the information for a given player, like such.
c((playerHTML%>%html_nodes("td")%>%html_text())[3:7],playerAttributes[[2]][2],playerAttributes[[length(playerAttributes)]][2])
##
## "9494" "Lionel Messi" "RWSTCF"
## title
## "33" "679" "Argentina"
## title
## "FC Barcelona FIFA 20"
Now, that we know how to pull the information from one player, let’s do this a few thousand times to get all the players information.
##Building Database
#filling database with mock row. Everything is a string to avoid any data mismatch problems.
baseDeDatos = data.frame("OVRPOT" = "1234","Name" = "Juan","prefPosition" = "RW","Age" = "30","Hits" = "1",
"Pais" = "Nicaragua", "Equipo" = "Managua FC", stringsAsFactors = F)
for(pagina in 1:655){ #website cursor
#save the page. Notice we will iterate over all the pages available.
fifa <- read_html(paste("https://www.fifaindex.com/players/fifa20/",pagina,"/",sep = ""))
#Note 1:
#there are 30 players per page. They start in tr# 3, and end in tr # 42
#there are 2 spaces every 5 players - thats the reason it ends in tr#42 and not tr # 32
#Note 2:
#last page has 22 players
if(pagina != 655){
for(numJugador in 3:42){ #player cursor
#Getting player 1st part info
jugador=(fifa %>% html_nodes(".table") %>% html_nodes("tbody") %>% html_nodes("tr"))[numJugador]
#ovr/pot;name;positions;age;hits
primeraParte = (jugador%>%html_nodes("td")%>%html_text())[3:7]
#we evaluate if what we obtained is a blank space or a player's info:
if(sum(is.na(primeraParte))==5){
next
} else {
#Getting Player's Nationality and Team
atributosJugador= jugador%>%html_nodes("td")%>%html_nodes("a")%>%html_attrs()
#Joining both pieces
finalJug = c(primeraParte,atributosJugador[[2]][2],
atributosJugador[[length(atributosJugador)]][2])
#adding to database
baseDeDatos<- rbind(baseDeDatos,finalJug)
}
}
} else {
for(numJugador in 3:30){ #player cursor
#Getting player 1st part info
jugador=(fifa %>% html_nodes(".table") %>% html_nodes("tbody") %>% html_nodes("tr"))[numJugador]
#ovr/pot;name;positions;age;hits
primeraParte = (jugador%>%html_nodes("td")%>%html_text())[3:7]
#we evaluate if what we obtained is a blank space or a player's info:
if(sum(is.na(primeraParte))==5){
next
} else {
#Getting Player's Nationality and Team
atributosJugador= jugador%>%html_nodes("td")%>%html_nodes("a")%>%html_attrs()
#Joining both pieces
finalJug = c(primeraParte,atributosJugador[[2]][2],
atributosJugador[[length(atributosJugador)]][2])
#adding to database
baseDeDatos<- rbind(baseDeDatos,finalJug)
}
}
}
}
An example, should be as follows, for the first few pages (output from data frame):
baseDeDatos
## OVRPOT Name prefPosition Age Hits
## 1 1234 Juan RW 30 1
## 2 9494 Lionel Messi RWSTCF 33 679
## 3 9393 Cristiano Ronaldo STLW 35 695
## 4 9292 Neymar Jr LWCAM 28 371
## 5 9192 Virgil van Dijk CB 29 314
## 6 9193 Jan Oblak GK 27 190
## 7 9191 Kevin De Bruyne CAMCM 29 304
## 8 9191 Robert Lewandowski ST 31 220
## 9 9191 Eden Hazard LWST 29 208
## 10 9091 Alisson GK 27 134
## 11 9090 Mohamed Salah RWST 28 287
## 12 9090 Sadio Mané LW 28 233
## 13 9093 Marc-André ter Stegen GK 28 156
## 14 9090 Sergio Agüero ST 32 124
## 15 8995 Kylian Mbappé STLWRW 21 771
## 16 8989 N'Golo Kanté CDMCM 29 186
## 17 8991 Harry Kane ST 26 191
## 18 8989 Antoine Griezmann CFSTLW 29 220
## 19 8989 Toni Kroos CM 30 162
## 20 8989 Luka Modric CM 34 134
## 21 8989 Luis Suárez ST 33 137
## 22 8989 Manuel Neuer GK 34 71
## 23 8989 Sergio Ramos CB 34 191
## 24 8891 Ederson GK 26 109
## 25 8890 Raheem Sterling LWRW 25 190
## 26 8888 Roberto Firmino CF 28 163
## 27 8890 Kalidou Koulibaly CB 29 155
## 28 8889 Casemiro CDM 28 131
## 29 8888 De Gea GK 29 126
## 30 8889 Thibaut Courtois GK 28 96
## 31 8888 Sergio Busquets CDM 32 74
## 32 8888 Pierre-Emerick Aubameyang STLM 31 173
## 33 8888 Karim Benzema CFST 32 162
## 34 8888 Samir Handanovic GK 36 33
## 35 8888 Piqué CB 33 70
## 36 8888 Giorgio Chiellini CB 35 53
## 37 8790 Bernardo Silva RWCAMCM 25 129
## 38 8790 Joshua Kimmich CDMRBCM 25 175
## 39 8790 Aymeric Laporte CB 26 95
## 40 8790 Paulo Dybala CFCAM 26 258
## 41 8787 Heung Min Son LMCF 28 165
## 42 8788 Marco Verratti CMCDM 27 86
## 43 8788 Paul Pogba CMCDM 27 247
## 44 8787 Keylor Navas GK 33 75
## 45 8787 Ciro Immobile ST 30 102
## 46 8787 Christian Eriksen CAMCMRM 28 107
## 47 8787 Parejo CM 31 57
## 48 8787 Marco Reus CAMCF 31 119
## 49 8788 Wojciech Szczesny GK 30 65
## 50 8787 Ángel Di María RWLW 32 77
## 51 8787 Diego Godín CB 34 52
## 52 8787 Mats Hummels CB 31 59
## 53 8787 Dries Mertens CFST 33 68
## 54 8787 David Silva CAMCM 34 75
## 55 8787 Hugo Lloris GK 33 48
## 56 8787 Thiago Silva CB 35 92
## 57 8694 Jadon Sancho RMLMCAM 20 496
## 58 8690 Milan Škriniar CB 25 146
## 59 8692 Frenkie de Jong CM 23 252
## 60 8690 Leroy Sané LW 24 193
## 61 8690 Clément Lenglet CB 25 123
## 62 8689 Andrew Robertson LB 26 194
## 63 8689 Bruno Fernandes CAMCM 25 392
## 64 8689 Timo Werner ST 24 338
## 65 8688 Fabinho CDM 26 101
## 66 8686 Jamie Vardy ST 33 92
## 67 8687 Hakim Ziyech CAMRW 27 322
## 68 8690 Marquinhos CBCDM 26 93
## 69 8686 Riyad Mahrez RWRM 29 120
## 70 8689 Raphaël Varane CB 27 120
## 71 8687 Mauro IcardiL ST 27 119
## 72 8686 Lorenzo Insigne CFLWLM 29 79
## 73 8686 Koke CMRMLM 28 53
## 74 8687 Romelu Lukaku ST 27 144
## 75 8686 Thiago CMCDM 29 98
## 76 8686 Jordi Alba LB 31 64
## 77 8686 Leonardo Bonucci CB 33 43
## 78 8686 Toby Alderweireld CB 31 52
## 79 8686 Miralem Pjanic CMCDM 30 94
## 80 8686 Edinson Cavani ST 33 115
## 81 8686 Yann Sommer GK 31 27
## 82 8686 Alejandro Gómez CAMCFST 32 102
## 83 8592 Matthijs de Ligt CB 20 199
## 84 8589 Rodri CDMCM 24 104
## 85 8590 Trent Alexander-Arnold RB 21 414
## 86 8590 Arthur CM 23 149
## 87 8592 Gianluigi Donnarumma GK 21 193
## 88 8589 André Onana GK 24 103
## 89 8590 Sergej Milinkovic-Savic CMCDMCAM 25 124
## 90 8587 Nabil Fekir CAMRMST 26 73
## 91 8589 José María Giménez CB 25 64
## 92 8590 Niklas Süle CB 24 76
## 93 8589 Saúl CMLMLB 25 92
## 94 8587 Serge Gnabry RMLMRW 25 144
## 95 8588 Samuel Umtiti CB 26 89
## 96 8585 Carvajal RB 28 79
## 97 8586 Luis Alberto CAMCMCF 27 46
## 98 8586 Stefan de Vrij CB 28 49
## 99 8585 Pizzi RMCM 30 34
## 100 8585 Isco CAMCMLW 28 95
## 101 8585 Iago Aspas STRW 32 36
## 102 8587 Bernd Leno GK 28 63
## 103 8585 Thomas Müller CAMRMRW 30 57
## 104 8585 CoutinhoL CAMLWCM 28 151
## 105 8586 Roman Bürki GK 29 33
## 106 8585 Paulinho CMCAMCDM 31 38
## 107 8586 Péter Gulácsi GK 30 27
## 108 8585 Jordan Henderson CMCDM 30 115
## 109 8585 Georginio Wijnaldum CMCDM 29 117
## 110 8585 Axel Witsel CDMCM 31 72
## 111 8585 Gareth Bale RWSTLW 31 251
## 112 8585 Jan Vertonghen CBLB 33 43
## 113 8585 Ivan Rakitic CM 32 62
## 114 8585 Gonzalo Higuaín ST 32 72
## 115 8585 Fernandinho CBCDM 35 59
## 116 8585 Zlatan Ibrahimovic ST 38 476
## 117 8493 Kai Havertz CAMRM 21 491
## 118 8489 Marcus Rashford LMST 22 303
## 119 8491 Lautaro Martínez ST 22 287
## 120 8488 Wilfred Ndidi CDMCM 23 93
## 121 8489 Lucas Hernández CBLB 24 111
## 122 8488 Kingsley Coman LMRMLW 24 116
## 123 8485 Alex Telles LB 27 83
## 124 8488 Julian Brandt CAMCMLM 24 111
## 125 8486 Ricardo Pereira RB 26 70
## 126 8487 Thomas Partey CMCDM 27 80
## 127 8488 Leon Goretzka CMCAMCDM 25 99
## 128 8484 Felipe CB 31 39
## 129 8487 Mateo Kovacic CM 26 103
## 130 8484 Jorginho CMCDM 28 108
## 131 8487 Memphis Depay CFLWCAM 26 120
## 132 8484 Josip Ilicic CFST 32 72
## 133 8484 Allan CM 29 39
## 134 8484 Francesco Acerbi CB 32 30
## 135 8486 Anthony Lopes GK 29 20
## 136 8484 Wissam Ben Yedder ST 29 87
## 137 8484 James Rodríguez CAMCMRM 29 179
## 138 8485 Neto GK 30 22
## 139 8484 Idrissa Gueye CDMCM 30 69
## 140 8484 Alexandre Lacazette ST 29 90
## 141 8485 Kostas Manolas CB 29 35
## 142 8484 Alex Sandro LBLM 29 52
## 143 8484 Douglas Costa LMRWLW 29 99
## 144 8484 Canales CAMCMLM 29 26
## 145 8484 Oscar CAMCMLW 28 69
## 146 8484 Ilkay Gündogan CMCDM 29 37
## 147 8484 José Callejón RMRW 33 59
## 148 8484 Azpilicueta RBLBCB 30 72
## 149 8484 Arturo Vidal CMCDMCAM 33 81
## 150 8484 Edin Džeko ST 34 48
## 151 8484 Éver Banega CMCDM 32 29
## 152 8484 Radja NainggolanL CAMCMCF 32 50
## 153 8484 Marcelo LB 32 93
## 154 8484 Lucas Leiva CDM 33 23
## 155 8484 Blaise Matuidi CDMCM 33 69
## 156 8484 Salvatore Sirigu GK 33 17
## 157 8484 João Moutinho CM 33 46
## 158 8390 Ousmane Dembélé LWRW 23 207
## 159 8383 Ronaldo Cabrais RWCAM 28 54
## 160 8383 Josué Chiamulera CB 28 24
## 161 8383 Louri Beretta STCF 28 46
## 162 8389 Oyarzabal LWRW 23 92
## 163 8389 Fabián CM 24 74
## 164 8387 Donny van de Beek CMCAM 23 111
## 165 8388 Pau López GK 25 34
## 166 8384 Dakonam Djené CB 28 23
## 167 8384 Rafa LMRM 27 47
## 168 8383 Andrej Kramaric STCAM 29 26
## 169 8385 Marcelo Brozovic CDMCM 27 38
## 170 8383 Duván Zapata ST 29 175
## 171 8386 Anderson Talisca CAMRW 26 50
## 172 8388 Thomas Strakosha GK 25 39
## 173 8387 Anthony Martial ST 24 196
## 174 8384 Nicolás Tagliafico LB 27 90
## 175 8388 Dele Alli CAMCM 24 98
## 176 8389 Alessio Romagnoli CB 25 91
## 177 8387 Grimaldo LB 24 68
## 178 8384 Raphaël Guerreiro LMLBCM 26 63
## 179 8383 Quincy Promes LWCAM 28 70
## 180 8383 Filip Kostic LMLWB 27 46
## 181 8384 Yannick CarrascoL LM 26 59
## Pais Equipo
## 1 Nicaragua Managua FC
## 2 Argentina FC Barcelona FIFA 20
## 3 Portugal Juventus FIFA 20
## 4 Brazil Paris Saint-Germain FIFA 20
## 5 Netherlands Liverpool FIFA 20
## 6 Slovenia Atlético Madrid FIFA 20
## 7 Belgium Manchester City FIFA 20
## 8 Poland FC Bayern München FIFA 20
## 9 Belgium Real Madrid FIFA 20
## 10 Brazil Liverpool FIFA 20
## 11 Egypt Liverpool FIFA 20
## 12 Senegal Liverpool FIFA 20
## 13 Germany FC Barcelona FIFA 20
## 14 Argentina Manchester City FIFA 20
## 15 France Paris Saint-Germain FIFA 20
## 16 France Chelsea FIFA 20
## 17 England Tottenham Hotspur FIFA 20
## 18 France FC Barcelona FIFA 20
## 19 Germany Real Madrid FIFA 20
## 20 Croatia Real Madrid FIFA 20
## 21 Uruguay FC Barcelona FIFA 20
## 22 Germany FC Bayern München FIFA 20
## 23 Spain Real Madrid FIFA 20
## 24 Brazil Manchester City FIFA 20
## 25 England Manchester City FIFA 20
## 26 Brazil Liverpool FIFA 20
## 27 Senegal Napoli FIFA 20
## 28 Brazil Real Madrid FIFA 20
## 29 Spain Manchester United FIFA 20
## 30 Belgium Real Madrid FIFA 20
## 31 Spain FC Barcelona FIFA 20
## 32 Gabon Arsenal FIFA 20
## 33 France Real Madrid FIFA 20
## 34 Slovenia Inter FIFA 20
## 35 Spain FC Barcelona FIFA 20
## 36 Italy Juventus FIFA 20
## 37 Portugal Manchester City FIFA 20
## 38 Germany FC Bayern München FIFA 20
## 39 France Manchester City FIFA 20
## 40 Argentina Juventus FIFA 20
## 41 Korea Republic Tottenham Hotspur FIFA 20
## 42 Italy Paris Saint-Germain FIFA 20
## 43 France Manchester United FIFA 20
## 44 Costa Rica Paris Saint-Germain FIFA 20
## 45 Italy Lazio FIFA 20
## 46 Denmark Inter FIFA 20
## 47 Spain Valencia CF FIFA 20
## 48 Germany Borussia Dortmund FIFA 20
## 49 Poland Juventus FIFA 20
## 50 Argentina Paris Saint-Germain FIFA 20
## 51 Uruguay Inter FIFA 20
## 52 Germany Borussia Dortmund FIFA 20
## 53 Belgium Napoli FIFA 20
## 54 Spain Manchester City FIFA 20
## 55 France Tottenham Hotspur FIFA 20
## 56 Brazil Paris Saint-Germain FIFA 20
## 57 England Borussia Dortmund FIFA 20
## 58 Slovakia Inter FIFA 20
## 59 Netherlands FC Barcelona FIFA 20
## 60 Germany Manchester City FIFA 20
## 61 France FC Barcelona FIFA 20
## 62 Scotland Liverpool FIFA 20
## 63 Portugal Manchester United FIFA 20
## 64 Germany RB Leipzig FIFA 20
## 65 Brazil Liverpool FIFA 20
## 66 England Leicester City FIFA 20
## 67 Morocco Ajax FIFA 20
## 68 Brazil Paris Saint-Germain FIFA 20
## 69 Algeria Manchester City FIFA 20
## 70 France Real Madrid FIFA 20
## 71 Argentina Paris Saint-Germain FIFA 20
## 72 Italy Napoli FIFA 20
## 73 Spain Atlético Madrid FIFA 20
## 74 Belgium Inter FIFA 20
## 75 Spain FC Bayern München FIFA 20
## 76 Spain FC Barcelona FIFA 20
## 77 Italy Juventus FIFA 20
## 78 Belgium Tottenham Hotspur FIFA 20
## 79 Bosnia & Herzegovina Juventus FIFA 20
## 80 Uruguay Paris Saint-Germain FIFA 20
## 81 Switzerland Borussia Mönchengladbach FIFA 20
## 82 Argentina Atalanta FIFA 20
## 83 Netherlands Juventus FIFA 20
## 84 Spain Manchester City FIFA 20
## 85 England Liverpool FIFA 20
## 86 Brazil FC Barcelona FIFA 20
## 87 Italy Milan FIFA 20
## 88 Cameroon Ajax FIFA 20
## 89 Serbia Lazio FIFA 20
## 90 France Real Betis FIFA 20
## 91 Uruguay Atlético Madrid FIFA 20
## 92 Germany FC Bayern München FIFA 20
## 93 Spain Atlético Madrid FIFA 20
## 94 Germany FC Bayern München FIFA 20
## 95 France FC Barcelona FIFA 20
## 96 Spain Real Madrid FIFA 20
## 97 Spain Lazio FIFA 20
## 98 Netherlands Inter FIFA 20
## 99 Portugal SL Benfica FIFA 20
## 100 Spain Real Madrid FIFA 20
## 101 Spain RC Celta FIFA 20
## 102 Germany Arsenal FIFA 20
## 103 Germany FC Bayern München FIFA 20
## 104 Brazil FC Bayern München FIFA 20
## 105 Switzerland Borussia Dortmund FIFA 20
## 106 Brazil Guangzhou Evergrande Taobao FC FIFA 20
## 107 Hungary RB Leipzig FIFA 20
## 108 England Liverpool FIFA 20
## 109 Netherlands Liverpool FIFA 20
## 110 Belgium Borussia Dortmund FIFA 20
## 111 Wales Real Madrid FIFA 20
## 112 Belgium Tottenham Hotspur FIFA 20
## 113 Croatia FC Barcelona FIFA 20
## 114 Argentina Juventus FIFA 20
## 115 Brazil Manchester City FIFA 20
## 116 Sweden Milan FIFA 20
## 117 Germany Bayer 04 Leverkusen FIFA 20
## 118 England Manchester United FIFA 20
## 119 Argentina Inter FIFA 20
## 120 Nigeria Leicester City FIFA 20
## 121 France FC Bayern München FIFA 20
## 122 France FC Bayern München FIFA 20
## 123 Brazil FC Porto FIFA 20
## 124 Germany Borussia Dortmund FIFA 20
## 125 Portugal Leicester City FIFA 20
## 126 Ghana Atlético Madrid FIFA 20
## 127 Germany FC Bayern München FIFA 20
## 128 Brazil Atlético Madrid FIFA 20
## 129 Croatia Chelsea FIFA 20
## 130 Italy Chelsea FIFA 20
## 131 Netherlands Olympique Lyonnais FIFA 20
## 132 Slovenia Atalanta FIFA 20
## 133 Brazil Napoli FIFA 20
## 134 Italy Lazio FIFA 20
## 135 Portugal Olympique Lyonnais FIFA 20
## 136 France AS Monaco Football Club SA FIFA 20
## 137 Colombia Real Madrid FIFA 20
## 138 Brazil FC Barcelona FIFA 20
## 139 Senegal Paris Saint-Germain FIFA 20
## 140 France Arsenal FIFA 20
## 141 Greece Napoli FIFA 20
## 142 Brazil Juventus FIFA 20
## 143 Brazil Juventus FIFA 20
## 144 Spain Real Betis FIFA 20
## 145 Brazil Shanghai SIPG FC FIFA 20
## 146 Germany Manchester City FIFA 20
## 147 Spain Napoli FIFA 20
## 148 Spain Chelsea FIFA 20
## 149 Chile FC Barcelona FIFA 20
## 150 Bosnia & Herzegovina Roma FIFA 20
## 151 Argentina Sevilla FC FIFA 20
## 152 Belgium Cagliari FIFA 20
## 153 Brazil Real Madrid FIFA 20
## 154 Brazil Lazio FIFA 20
## 155 France Juventus FIFA 20
## 156 Italy Torino FIFA 20
## 157 Portugal Wolverhampton Wanderers FIFA 20
## 158 France FC Barcelona FIFA 20
## 159 Brazil Grêmio FIFA 20
## 160 Brazil Grêmio FIFA 20
## 161 Brazil Atlético Mineiro FIFA 20
## 162 Spain Real Sociedad FIFA 20
## 163 Spain Napoli FIFA 20
## 164 Netherlands Ajax FIFA 20
## 165 Spain Roma FIFA 20
## 166 Togo Getafe CF FIFA 20
## 167 Portugal SL Benfica FIFA 20
## 168 Croatia TSG 1899 Hoffenheim FIFA 20
## 169 Croatia Inter FIFA 20
## 170 Colombia Atalanta FIFA 20
## 171 Brazil Guangzhou Evergrande Taobao FC FIFA 20
## 172 Albania Lazio FIFA 20
## 173 France Manchester United FIFA 20
## 174 Argentina Ajax FIFA 20
## 175 England Tottenham Hotspur FIFA 20
## 176 Italy Milan FIFA 20
## 177 Spain SL Benfica FIFA 20
## 178 Portugal Borussia Dortmund FIFA 20
## 179 Netherlands Ajax FIFA 20
## 180 Serbia Eintracht Frankfurt FIFA 20
## 181 Belgium Atlético Madrid FIFA 20
Finally, we save it to a CSV file
write.csv(baseDeDatos,"fifaPlayersDB.csv")
And, if possible save it to SQL, final DB should look similar to this: