How do I import issues and articles from spreadsheet?




thank you very much! I’d give this a try.



This is absolutely brilliant, @ajnyga. Thank you so much!

I get this error, though, when I try to create an xml-file (I have used your example-spreadsheet for testing, only changing file names to test upload of my own pdf’s):

Fatal error: Call to undefined function mime_content_type() in .../convert.php on line 258

Do you have any idea what this might be caused by?


Hi, seems to be related to a missing php extension, see

edit: hmm, the function seems to be deprecated, I have to check if I could replace it with something.’

edit edit: or is it, what is your PHP version?


Thank you for helping! My php-version is 4.7.3.

edit: No, that was the phpMyAdmin version. The php-version is 5.6.30.


I am finding very mixed information on whether the function is deprecated or not.

Your could try enabling the mime_magic extension in php. If that does not work for you, you could try adding this function to the converter file.

function _mime_content_type($filename) {
    $result = new finfo();

    if (is_resource($result) === true) {
        return $result->file($filename, FILEINFO_MIME_TYPE);

    return false;


Hi all,

The mime_content_type function wasn’t deprecated, then it was, now it isn’t again.

The good news is that PKP software only uses it as a fallback when the “preferred” mechanism, the fileinfo suite of tools, isn’t available. See Error message on upload: “No file uploaded or invalid file type!” for more information about how OJS/OMP/etc. determine file types.

Alec Smecher
Public Knowledge Project Team

Import a lot of journals

Thanks, I’ve tried both without luck unfortunately. Maybe I could find / set up a server with an older version of php…


Hi @troelsk,

The most recent releases of OJS require PHP5.6 at least, and my dev environment runs on PHP5.6 without problems. If you’re changing your PHP module configuration, have you restarted your web server afterwards?

Alec Smecher
Public Knowledge Project Team


I’ve now managed to run your script on a php-server with version 7.0. Unfortunately, I just get another type of error, for some reason. What php version did you use originally, @ajnyga?

Fatal error: Uncaught Error: Class 'ZipArchive' not found in /home/isbuddet/public_html/troelskolln/ojs/tsvconverter/phpexcel/Classes/PHPExcel/Reader/Excel2007.php:94 Stack trace: #0 /home/isbuddet/public_html/troelskolln/ojs/tsvconverter/phpexcel/Classes/PHPExcel/IOFactory.php(268): PHPExcel_Reader_Excel2007->canRead('eksempel.xlsx') #1 /home/isbuddet/public_html/troelskolln/ojs/tsvconverter/convert.php(60): PHPExcel_IOFactory::createReaderForFile('eksempel.xlsx') #2 {main} thrown in /home/isbuddet/public_html/troelskolln/ojs/tsvconverter/phpexcel/Classes/PHPExcel/Reader/Excel2007.php on line 94


Hi @troelsk,

See e.g. for instructions on installing ZipArchive support. It’s available for all modern PHPs.

Alec Smecher
Public Knowledge Project Team


Hi @asmecher. Well, I don’t really need OJS to be running for this, I just need to get the xml-files created, so that’s not a concern for me. But thanks for the tip about restarting the server.


I used PHP 5.6, but it should work with PHP 7 as well. The problems you are experiencing are related to missing PHP extensions Alec also refererred to:

The PHPexcel library does mention that the zip extension is only needed if you use it with xlsx-files. So maybe you could test if a .xls files works?


Thank you again (also to @asmecher)!

All the extensions should now be installed on a php 7.0 installation. I’ve also tried with an .xls-file. However, I now a get a similar, but slighly different error 10 lines later.

Fatal error: Uncaught Error: Call to undefined function mime_content_type() in /home/isbuddet/public_html/troelskolln/ojs/tsvconverter/convert.php:268 Stack trace: #0 {main} thrown in /home/isbuddet/public_html/troelskolln/ojs/tsvconverter/convert.php on line 268

Btw, I completely understand if you don’t have time to go through all this. I am very grateful, though. This is by far the closest I’ve been to a solution so far!

Oh, and here is a photo of my php-installation (via cPanel):



You could try enabling fileinfo extension there and add the custom function I pasted in my earlier post?

Or, as second alternative, try to enable the mime_magic extension in cPanel. I have no good idea how you would do this, because I do not use cPanel myself.


HALLELUJA! It works. Thank you so much :slight_smile:

Now I just need to test the xml-file, and for some reason my OJS-installation is now broken, but that should be easy to fix (I get the error that I need to use a php version less than 7).


With PHP7, you probably need switch using mysqli. You can search the forum for details.

You can also try going back to PHP5 and enabling the fileinfo extension (and other needed extensions) with that version.


That works, thanks. So the xml-file gives me this error:

Element '{}affiliation': This element is not expected. Expected is one of ( {}url, {}orcid, {}biography ).

Seems to me like it doesn’t recognise that element. Actually, I don’t even need have that data to upload, so I guess I could just remove it from the script.


Can you show me what the data looks like (you can send the xls to if you do not want to show it here.

And, what OJS version are you importing to. I only used 3.0.2. so it could be that something changed recently in OJS XML.


Actually probably the easiest would be, if you would send me the XML file. I have imported authors with affiliations, but you perhaps have a combination of data that I have not had.

The author element in your XML should look like this. Does your element look different? Do you for example have multiple affiliation elements there?

    <author primary_contact="true" include_in_browse="true" user_group_ref="Author">
      <affiliation locale="en_US">XXXXXX</affiliation>
      <biography locale="en_US">XXXXXX</biography>

Edit: I made a new release of the script:
It should now check for the two alternative ways for mime type and I also changed the way the script handles localized affiliations. Not sure if it helps in your problem, but you could give it a try.


First of all: amazing help, thanks!

Second: I have attached the xml-file. It returns the same error in both your versions of the script (when uploading to OJS, that is).

The spreadsheet I use is based on your sample, with only the file names of the pdf’s changed (to test my own files). You can see the xml-file here and the spreadsheet here.

When I manually remove the affiliation tag from the xml-file, it seems to upload correctly to OJS - but I get the error “Unknown uploader admin”. That might be something to do with the setup of my OJS test site.

Edit: I am importing into OJS