Converting bib database into csv

Open the .bib-files in Jabref and export them as OpenOffice .csv-files. You find the option under the menu File, Export

Jabref_export

Since you can run Jabreffrom the program's home page, you don't have to install it. You need Java, though.


Best bet would be a scripting language, e.g. Python. I don't know if you are a programmer, but making a script taking each entry and converting them should be pretty quick (provided typing python script_file.py in the prompt doesn't scare you!). Python is also installed by default on most Unix OSes.

Here's a basic python script which accesses a few fields:

from pybtex.database.input import bibtex

#open a bibtex file
parser = bibtex.Parser()
bibdata = parser.parse_file("myrefs.bib")

#loop through the individual references
for bib_id in bibdata.entries:
    b = bibdata.entries[bib_id].fields
    try:
        # change these lines to create a SQL insert
        print(b["title"])
        print(b["journal"])
        print(b["year"])
        #deal with multiple authors
        for author in bibdata.entries[bib_id].persons["author"]:
            print(author.first(), author.last())
    # field may not exist for a reference
    except(KeyError):
        continue

You can adapt it to your needs and save desired fields to a .csv file.


A python version using bibtexparser bibtexparser and pandas

with open('ref.bib') as bibtex_file:
  bib_database = bibtexparser.load(bibtex_file)
df = pd.DataFrame(bib_database.entries)
df.to_csv('ref.csv', index=False)

And a minimal working example:

import bibtexparser
import pandas as pd

bibtex = """@article{ einstein1935can,
            title={Can quantum-mechanical description of physical reality be considered complete?},
            author={Einstein, Albert and Podolsky, Boris and Rosen, Nathan},
            journal={Physical review},
            volume={47},number={10},
            pages={777},
            year={1935},
            publisher={APS}}
            @inproceedings{sharma2017daniel,
            title={DANIEL: A deep architecture for automatic analysis and retrieval of building floor plans},
            author={Sharma, Divya and Gupta, Nitin and Chattopadhyay, Chiranjoy and Mehta, Sameep},
            booktitle={2017 14th IAPR International Conference on Document Analysis and Recognition (ICDAR)},
            volume={1},pages={420--425},year={2017},organization={IEEE}}"""

with open('ref.bib', 'w') as bibfile:
  bibfile.write(bibtex)
with open('ref.bib') as bibtex_file:
  bib_database = bibtexparser.load(bibtex_file)
df = pd.DataFrame(bib_database.entries)
df.to_csv('ref.csv', index=False)