You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import (
"encoding/json""fmt""github.com/FerdinaKusumah/excel2json""log"
)
funcmain() {
var (
result []*map[string]interface{}
errerrorurl="https://raw.githubusercontent.com/curran/data/gh-pages/senseYourCity/all.csv"// select only selected field// if you want to show all headers just passing nil or empty listheaders= []string{"humidity", "sound"}
delimited=","
)
ifresult, err=excel2json.GetCsvFileUrl(url, delimited, headers); err!=nil {
log.Fatalf(`unable to parse file, error: %s`, err)
}
for_, val:=rangeresult {
result, _:=json.Marshal(val)
fmt.Println(string(result))
}
}
Read csv from local source
import (
"encoding/json""fmt""github.com/FerdinaKusumah/excel2json""log"
)
funcmain() {
var (
result []*map[string]interface{}
errerrorpath="./all.csv"// select only selected field// if you want to show all headers just passing nil or empty listheaders= []string{"humidity", "sound"}
delimited=","
)
ifresult, err=excel2json.GetCsvFilePath(path, delimited, headers); err!=nil {
log.Fatalf(`unable to parse file, error: %s`, err)
}
for_, val:=rangeresult {
result, _:=json.Marshal(val)
fmt.Println(string(result))
}
}