Importing CSV line breaks

Importing CSV line breaks

by Dan Black -
Number of replies: 4

Hi.

I'm importing student feedback into the grade book from a CSV file, but line breaks aren't appearing in the result. The CSV cell formatting is the common double quotes with line feed characters inside. Do I need to format the CSV file differently to create line breaks in Moodle?

Thanks.

In reply to Dan Black

Re: Importing CSV line breaks

by Luis de Vasconcelos -
Picture of Particularly helpful Moodlers
This worked for me (on Windows, at least). Create your .csv file like this:

username,gradeitem_name,grade,comments
A12345,Quiz ABC,80,"Multi-line comment for user A12345.
With this showing on a new line."
B52414,Quiz ABC,75,"Multi-line comment for user B52414.
With this showing on a new line."

So, you put your whole comment in double quotes and split the comment onto two lines - inside the double quotes.
In reply to Luis de Vasconcelos

Re: Importing CSV line breaks

by Luis de Vasconcelos -
Picture of Particularly helpful Moodlers
You can split your comments into as many lines as you want, as long as the whole comment string for each username is wrapped around one set of quotes. And comments can be of variable lengths on multiple lines for each username:

username,gradeitem_name,grade,comments
A12345,Quiz ABC,80,"Multi-line comment for user A12345.
With this showing on a new line.
Approved by Tom Teacher"
B52414,Quiz ABC,75,"Multi-line comment for user B52414.
With this showing on a new line.
And three more lines below this.
Approved by Heather Headmaster
And checked by Charlie Checker.
Using Formula ABZ246XYC"
In reply to Luis de Vasconcelos

Re: Importing CSV line breaks

by Dan Black -

Hi Luis.

Thanks for the reply, but, no, I still can't get it to work. I'm working on a mac and exporting my csv files from a Filemaker database, so maybe it's an issue with the particular encoding being used; but even if I go through the csv file and change all the line break characters to a different format it doesn't work. I see the line breaks if I open the file in Excel or a plain text editor, but Moodle ignores them.