Are there tools for importing from CSV to BibTeX?
I won't give complete answer, but some suggestions (it would have to be really worked on to make it complete).
There are tools:
- xml2bib from bibutils
- csv2xml
The problem is that xml2bib needs a very special format called Metadata Object Description Schema: MODS.
Below, I give example file of my thesis .bib
bibliography, converted to the correct .xml
MODS format by bib2xml and coverted back to a .bib
file by xml2bib. It illustrates how complicated the XML format is:
I apologize for the long file listings but I don't have a reliable online file storage.
@book{beardon,
AUTHOR = {Beardon, Alan F.},
TITLE = {The geometry of discrete groups},
SERIES = {Graduate Texts in Mathematics},
VOLUME = {91},
NOTE = {Corrected reprint of the 1983 original},
PUBLISHER = {Springer-Verlag},
ADDRESS = {New York},
YEAR = {1995},
PAGES = {xii+337},
ISBN = {0-387-90788-2},
XXMRCLASS = {22E40 (11F06 20H15 30F35 57N10)},
XXMRNUMBER = {1393195 (97d:22011)},
}
@article{ford,
AUTHOR = {Ford, Lester R.},
TITLE = {The fundamental region for a {F}uchsian group},
JOURNAL = {Bull. Amer. Math. Soc.},
FJOURNAL = {Bulletin of the American Mathematical Society},
VOLUME = {31},
YEAR = {1925},
NUMBER = {9-10},
PAGES = {531--539},
ISSN = {0002-9904},
XXMRCLASS = {Contributed Item},
XXMRNUMBER = {1561111},
DOI = {10.1090/S0002-9904-1925-04104-X},
URL = {http://dx.doi.org/10.1090/S0002-9904-1925-04104-X},
}
@article{k:sr_rmg,
AUTHOR = {K{\r{u}}rka, Petr},
TITLE = {A symbolic representation of the real {M}\"obius group},
JOURNAL = {Nonlinearity},
FJOURNAL = {Nonlinearity},
VOLUME = {21},
YEAR = {2008},
NUMBER = {3},
PAGES = {613--623},
ISSN = {0951-7715},
CODEN = {NONLE5},
XXMRCLASS = {37F30 (37B10)},
XXMRNUMBER = {2396619 (2009j:37073)},
MRREVIEWER = {Jiri Fiser},
DOI = {10.1088/0951-7715/21/3/012},
URL = {http://dx.doi.org/10.1088/0951-7715/21/3/012},
}
<?xml version="1.0" encoding="UTF-8"?>
<modsCollection xmlns="http://www.loc.gov/mods/v3">
<mods ID="beardon">
<titleInfo>
<title>The geometry of discrete groups</title>
</titleInfo>
<name type="personal">
<namePart type="given">Alan</namePart>
<namePart type="given">F</namePart>
<namePart type="family">Beardon</namePart>
<role>
<roleTerm authority="marcrelator" type="text">author</roleTerm>
</role>
</name>
<originInfo>
<issuance>monographic</issuance>
<dateIssued>1995</dateIssued>
<publisher>Springer-Verlag</publisher>
<place>
<placeTerm type="text">New York</placeTerm>
</place>
</originInfo>
<typeOfResource>text</typeOfResource>
<genre authority="marcgt">book</genre>
<relatedItem type="host">
<titleInfo>
<title>Graduate Texts in Mathematics</title>
</titleInfo>
</relatedItem>
<note>Corrected reprint of the 1983 original</note>
<identifier type="isbn">0-387-90788-2</identifier>
<identifier type="citekey">beardon</identifier>
<part>
<detail type="volume"><number>91</number></detail>
</part>
</mods>
<mods ID="ford">
<titleInfo>
<title>The fundamental region for a Fuchsian group</title>
</titleInfo>
<name type="personal">
<namePart type="given">Lester</namePart>
<namePart type="given">R</namePart>
<namePart type="family">Ford</namePart>
<role>
<roleTerm authority="marcrelator" type="text">author</roleTerm>
</role>
</name>
<originInfo>
<dateIssued>1925</dateIssued>
</originInfo>
<typeOfResource>text</typeOfResource>
<relatedItem type="host">
<titleInfo>
<title>Bull. Amer. Math. Soc.</title>
</titleInfo>
<originInfo>
<issuance>continuing</issuance>
</originInfo>
<genre authority="marcgt">periodical</genre>
<genre>academic journal</genre>
<identifier type="issn">0002-9904</identifier>
</relatedItem>
<identifier type="citekey">ford</identifier>
<identifier type="doi">10.1090/S0002-9904-1925-04104-X</identifier>
<location>
<url>http://dx.doi.org/10.1090/S0002-9904-1925-04104-X</url>
</location>
<part>
<date>1925</date>
<detail type="volume"><number>31</number></detail>
<detail type="number"><number>9-10</number></detail>
<extent unit="page">
<start>531</start>
<end>539</end>
</extent>
</part>
</mods>
<mods ID="k:sr_rmg">
<titleInfo>
<title>A symbolic representation of the real Möbius group</title>
</titleInfo>
<name type="personal">
<namePart type="given">Petr</namePart>
<namePart type="family">K\rurka</namePart>
<role>
<roleTerm authority="marcrelator" type="text">author</roleTerm>
</role>
</name>
<originInfo>
<dateIssued>2008</dateIssued>
</originInfo>
<typeOfResource>text</typeOfResource>
<relatedItem type="host">
<titleInfo>
<title>Nonlinearity</title>
</titleInfo>
<originInfo>
<issuance>continuing</issuance>
</originInfo>
<genre authority="marcgt">periodical</genre>
<genre>academic journal</genre>
<identifier type="issn">0951-7715</identifier>
</relatedItem>
<identifier type="citekey">k:sr_rmg</identifier>
<identifier type="doi">10.1088/0951-7715/21/3/012</identifier>
<location>
<url>http://dx.doi.org/10.1088/0951-7715/21/3/012</url>
</location>
<part>
<date>2008</date>
<detail type="volume"><number>21</number></detail>
<detail type="number"><number>3</number></detail>
<extent unit="page">
<start>613</start>
<end>623</end>
</extent>
</part>
</mods>
</modsCollection>
@Book{beardon,
author="Beardon, Alan F.",
title="The geometry of discrete groups",
series="Graduate Texts in Mathematics",
year="1995",
publisher="Springer-Verlag",
address="New York",
volume="91",
note="Corrected reprint of the 1983 original",
isbn="0-387-90788-2"
}
@Article{ford,
author="Ford, Lester R.",
title="The fundamental region for a Fuchsian group",
journal="Bull. Amer. Math. Soc.",
year="1925",
volume="31",
number="9-10",
pages="531--539",
issn="0002-9904",
doi="10.1090/S0002-9904-1925-04104-X",
url="http://dx.doi.org/10.1090/S0002-9904-1925-04104-X"
}
@Article{k:sr_rmg,
author="K{\backslash}rurka, Petr",
title="A symbolic representation of the real M{\"o}bius group",
journal="Nonlinearity",
year="2008",
volume="21",
number="3",
pages="613--623",
issn="0951-7715",
doi="10.1088/0951-7715/21/3/012",
url="http://dx.doi.org/10.1088/0951-7715/21/3/012"
}
Now: The following is an input file with header and one bibliography item (containing for each field the filed name with abc...xyz
dummy text). I believe that the output XML file could be converted into the MODS format, but I'm not sure how and it will be a lot of work. The why that I thought of is replacing each string of the form <Title>
to the string of XML markups that stands before the Title in the correct format.
Book Id,Title,Author,Author l-f,Additional Authors,ISBN,ISBN13,My Rating,Average Rating,Publisher,Binding,Number of Pages,Year Published,Original Publication Year,Date Read,Date Added,Bookshelves,Bookshelves with positions,Exclusive Shelf,My Review,Spoiler,Private Notes,Read Count,Recommended For,Recommended By,Owned Copies,Original Purchase Date,Original Purchase Location,Condition,Condition Description,BCID
abcBook Idxyz,abcTitlexyz,abcAuthorxyz,abcAuthor l-fxyz,abcAdditional Authorsxyz,abcISBNxyz,abcISBN13xyz,abcMy Ratingxyz,abcAverage Ratingxyz,abcPublisherxyz,abcBindingxyz,abcNumber of Pagesxyz,abcYear Publishedxyz,abcOriginal Publication Yearxyz,abcDate Readxyz,abcDate Addedxyz,abcBookshelvesxyz,abcBookshelves with positionsxyz,abcExclusive Shelfxyz,abcMy Reviewxyz,abcSpoilerxyz,abcPrivate Notesxyz,abcRead Countxyz,abcRecommended
<row>
<Book_Id>abcBook Idxyz</Book_Id>
<Title>abcTitlexyz</Title>
<Author>abcAuthorxyz</Author>
<Author_l_f>abcAuthor l-fxyz</Author_l_f>
<Additional_Authors>abcAdditional Authorsxyz</Additional_Authors>
<ISBN>abcISBNxyz</ISBN>
<ISBN13>abcISBN13xyz</ISBN13>
<My_Rating>abcMy Ratingxyz</My_Rating>
<Average_Rating>abcAverage Ratingxyz</Average_Rating>
<Publisher>abcPublisherxyz</Publisher>
<Binding>abcBindingxyz</Binding>
<Number_of_Pages>abcNumber of Pagesxyz</Number_of_Pages>
<Year_Published>abcYear Publishedxyz</Year_Published>
<Original_Publication_Year>abcOriginal Publication Yearxyz</Original_Publication_Year>
<Date_Read>abcDate Readxyz</Date_Read>
<Date_Added>abcDate Addedxyz</Date_Added>
<Bookshelves>abcBookshelvesxyz</Bookshelves>
<Bookshelves_with_positions>abcBookshelves with positionsxyz</Bookshelves_with_positions>
<Exclusive_Shelf>abcExclusive Shelfxyz</Exclusive_Shelf>
<My_Review>abcMy Reviewxyz</My_Review>
<Spoiler>abcSpoilerxyz</Spoiler>
<Private_Notes>abcPrivate Notesxyz</Private_Notes>
<Read_Count>abcRead Countxyz</Read_Count>
<Recommended_For>abcRecommended Forxyz</Recommended_For>
<Recommended_By>abcRecommended Byxyz</Recommended_By>
<Owned_Copies>abcOwned Copiesxyz</Owned_Copies>
<Original_Purchase_Date>abcOriginal Purchase Datexyz</Original_Purchase_Date>
<Original_Purchase_Location>abcOriginal Purchase Locationxyz</Original_Purchase_Location>
<Condition>abcConditionxyz</Condition>
<Condition_Description>abcCondition Descriptionxyz</Condition_Description>
<BCID>abcBCIDxyz</BCID>
</row>
Zotero
I do not use Goodreads
, but I suggest that you try Zotero, and see if Zotero can import directly. Maybe it is able to fetch all your books directly in one operation. Zotero standalone works with different browser and on different platforms.
Try it, it is free so you do not waste any money.
MarcEdit + Bibutils
A two step solution is using MarcEdit: You can import a delimited file (f.ex. CSV) directly. Then it is just to save it to any suitable format supported by your .bib-file manager. If you need to clean up or manipulate the CSV-files, you can use Sam Franche’s CSVed.
Complete solution: Import your CSV-files into
MarcEdit
. Save asMODS
-file. You can then usebibutils
to convert from MODS-format into bibtex, as recommended by tohecz.
You can also import a MODS-file exported from MarcEdit into Zotero, clean it up and export it to bibtex
-format.
Jabref
Jabref can import several formats, but I am not absolute sure any of those can be exported from MarcEdit. JabRef
also read from SQL databases (MySQL etc). You can import your CSV-files into a MySQL table, let JabRef import it and export it as an .bib-file.
Since the CSV has an ISBN for each book, and since all of the information I need for BibTeX can be reconstructed from the ISBN, all I need to do is use the ISBN column from the CSV to create an array, and then generate a file containing the corresponding BibTeX information:
#!/bin/bash
#Generate a BibTeX bibliography from an array of ISBNs
array=(<pasted column of ISBNs>)
rm goodreads.bib
for isbn in "${isbnarray[@]}"
do
curl http://manas.tungare.name/software/isbn-to-bibtex/isbn-service?isbn=$isbn >> goodreads.bib
done
And that's it.