Help with OJS Reports: Exporting data to a CSV file


I am having a difficult time to get some data from a CSV file via OJS. My current version is the OJS and everytime I click on the link to download a CSV file (in Articles Report), the system returns a file that is corrupted, the data tabulation is broken and I guess that it’s caused by the quotation marks in the file. Because of that, I cannot import the file to the Microsoft Excel in order to work with these data. I also tried to change the separators from “,” to “;” and other options that the Microsoft Excel offers, but I had no success until now.

Is anyone facing something like that? Or even, is that any solution to this problem?

Thank you in advance.


Hi @almeida-fabio,

We use PHP’s fputcsv function to generate CSV output. This uses as a default commas (,) as delimiters, quotes (") for quoting, and backslashes (\ ) as escape characters. Unfortunately I can’t give you specific guidance on using the Excel import wizard, as I have OpenOffice here. If you do have OpenOffice, I’ve found its import wizard to be pretty useful. Either wizard should have a way to choose settings to match what fputcsv generates.

Alec Smecher
Public Knowledge Project Team

Dear @asmecher, thank you!

I’ll try to use OpenOffice to see if I can work on these data. As soon as I do that, I’ll give you a feedback.

Best regards,

Yeah I had now similar issue… OJS exported raw data including comments so I needed to clear the .csv in right way for Excel to import it properly.

So first review comments if contain new liners ascii is broken in few lines so 1st we need to make it single line again (thanks to stackowerflow example):
sed -n ‘s|\r||g;$!{1{x;d};H};${H;x;s|\n(Review)|\r\1|g; s|\n||g;s|\r|\n|g;p}’ reviews-xxxxx.csv > corrected.csv

then in case of duplicates in notepad++ you can use function Edit > Line Operations > Remove Duplicate Lines.

And then import :slight_smile: