CSV: unexpected data type [][]string in file


Something’s wrong with the CSV files.

I’ve been using them for quite some time and all of the sudden the Hugo Server throws “ERROR unexpected data type [][]string in file books.csv”

I never changed anything in my csv file, I never touched anything. Everything is as it should be. I am not even CALLING the csv file.

I have the file stored in hugo/projectName/data/ throws the error all by itself, without me even calling it or anything. Just by having the file there, it throws the error.


We need more info than this in order to help you troubleshoot. At the least, what’s the CSV file look like?


It looks exactly like this:


(I couldn’t resist)

The error was that the csv was in a /data/ folder. The moment I moved it to a /csv/ folder, it worked fine again. I never recall reading in the docs that csv files needed a csv file to work, but they do.


What’s the other option?


My bad, I meant “I never recall reading in the docs that csv files needed to be in a directory named csv to work”. Btw, if you know csv and Hugo>> CSV range and select a single row




Is that the case?

The local CSV files to be loaded using getCSV must be located outside of the data directory.

Can you put it in a directory called something else, but still load the CSV?

split this topic #8

A post was split to a new topic: Questions about getCSV