added reading csv file
This commit is contained in:
parent
43825687bb
commit
126d48c25b
22
examples/read-file/ReadCsvFile.go
Normal file
22
examples/read-file/ReadCsvFile.go
Normal file
@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/csv"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
resp, err := os.Open("example.csv")
|
||||
if err != nil {
|
||||
log.Fatalln("Couldn't open the csv file", err)
|
||||
}
|
||||
r, err := csv.NewReader(resp).ReadAll()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
fmt.Println(r)
|
||||
|
||||
}
|
13
examples/read-file/example.csv
Normal file
13
examples/read-file/example.csv
Normal file
@ -0,0 +1,13 @@
|
||||
Fabri
|
||||
Loris Karius
|
||||
Gokhan Gonul
|
||||
Caner Erkin
|
||||
Victor Ruiz
|
||||
Atiba Hutchinson
|
||||
Oguzhan Ozyakup
|
||||
Talisca
|
||||
Sosa
|
||||
Ricardo Quaresma
|
||||
N'koudou
|
||||
Cenk Tosun
|
||||
Mario Gomez
|
|
Loading…
x
Reference in New Issue
Block a user