1. Get the code
You can either clone the github repo on you machine or just create manually a new python file and copy the source code below.
from pybtex.database.input import bibtex
import csv
# open a bibtex file
parser = bibtex.Parser()
# change Lib.bib to your target filename
bibdata = parser.parse_file("Lib.bib")
data_list = [
["Title", "Year", "Authors"]
]
# loop through the individual references
for bib_id in bibdata.entries:
b = bibdata.entries[bib_id].fields
entry = []
try:
entry.append(b["title"])
entry.append(b["year"])
# deal with multiple authors
authors = []
for author in bibdata.entries[bib_id].persons["author"]:
first_names = ' '.join(author.first_names)
last_names = ' '.join(author.last_names)
full_name = first_names + ' ' + last_names
authors.append(full_name)
entry.append(', '.join(authors))
data_list.append(entry)
# field may not exist for a reference
except(KeyError):
print("error")
continue
# save data_list to a csv file called data_export.csv
with open('data_export.csv', 'w', newline='') as file:
writer = csv.writer(file, quoting=csv.QUOTE_NONNUMERIC, delimiter=';')
writer.writerows(data_list)
The python module pybtex version 0.22.2 is needed to run the script. So be sure to install it with the command
pip install pybtex==0.22.2
2. Move your bibtex file to your script location
Rename your bibtex file into Lib.bibtex and move it on the same location as your previous created/cloned python script file.
3. Run the script
By double clicking on the python script or via the standard python command on the terminal, execute the python script. After that you should see a file called data_list.csv with your libary as the content.
python main.py
4. Create a Notion table
Inside of Notion create a new table with the same structure as in the data_list.csv, by default it has three columns named Title, Year and Author.
All entries are text fields right now. Feel free to change for example the year column to integer.
Click on the top bar of your Notion table on the three dots.

Select Merge with CSV and select your create data_list.csv file.

And thats it! After that you should have a filled table with your literature. It is also possible to update it after time with the same procedure.

As you can see, right now are just 3 attributes supported but it is possible to adjust the attributes as you prefer on the python script. For help just leave a commend below.