28 lines
396 B
Go
28 lines
396 B
Go
package utils
|
|
|
|
import (
|
|
"encoding/csv"
|
|
"os"
|
|
)
|
|
|
|
func ReadCSV(filePath string) ([][]string, error) {
|
|
file, err := os.Open(filePath)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer file.Close()
|
|
|
|
reader := csv.NewReader(file)
|
|
|
|
reader.Comma = ';'
|
|
reader.LazyQuotes = true
|
|
reader.FieldsPerRecord = -1
|
|
|
|
records, err := reader.ReadAll()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return records, nil
|
|
}
|