Skip to content

list of csv headers as values / variables #1208

Answered by yesoreyeram
fadingNA asked this question in Q&A
Discussion options

You must be logged in to vote

right.. found a hack https://play.grafana.org/goto/KvJSQjoNR?orgId=1. Idea is to pretend the csv doesn't have headers and injecting a header. By using fake delimiter, entire first line will become single field.

For reference the UQL query is

parse-csv --delimiter ";;;" --columns 'headers' ## prepending fake headers using dummy delimiter
| limit 1                                       ## limit it to first row which contain headers
| project "header"=split("headers",',')         ## split the csv values into array
| mv-expand "server"="header"                   ## expand array item into rows
| where "server" != 'metric'                    ## removing unnecessary headers if required
# | echo "…

Replies: 3 comments 9 replies

Comment options

You must be logged in to vote
9 replies
@yesoreyeram
Comment options

@yesoreyeram
Comment options

@fadingNA
Comment options

@yesoreyeram
Comment options

@yesoreyeram
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by yesoreyeram
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants