Jump to: navigation, search
Protected "Gramps 4.2 Wiki Manual - Manage Family Trees: CSV Import and Export": fix protection (lost after migration!) ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
{{out of date|The behavior of the program has changed in some points}}
== Gramps Spreadsheet Import/Export ==
# Start Gramps
# Select "Export" from the menu {{man menu|Family Trees menu->Export...}}# Select {{man button|Next}} on the {{man label|Saving your data}} window.# Select "'''Comma Separated Values Spreadsheet (CSV)"''' on the {{man label|Choose the output format}} window# On the {{man label|Export options}} window.## In the top section select which filters to apply to your family tree# Select # From the checkboxes select which items to include in the export (people, marriages, familieschildren, and/or places)and whether to Translate headers into the language you are using.  
A selected set of fields of your genealogy data will be saved to a .csv file in the format described below. In addition, the people and families are referenced so that the data can be edited and read back in, thereby updating the database.
There are some columns that will be blank, specifically note and source columns. These are listed in the spreadsheet so that you can make notes for the import, but notes are never exported with this tool. '''{{man note|From Gramps 3.3 |you can now export source titles; previously no source data was exported.'''}}
Your data is broken up into four sections representing places, individuals, marriages, and children. The exported fields and column names are:
{{man note|LibreOffice allows you to turn off auto-formatting when you open the CSV file.|If you don't do this, LibreOffice may interpret the dates incorrectly. Change the type of the column to Text rather than Standard. If your spreadsheet program doesn't allow you to format the fields before you get it into columns you need to change the display format of dates in Gramps before you export. You can do this under {{man menu|Edit -> Preferences -> Display -> Date Format}}}}.
{{man note|Excel allows you to format columns as text when you open the CSV file.|If you don't do this, Excel may interpret the dates incorrectly. Change the type of the column to Text rather than General.
One way to do this is to open the CSV from the file menu (select 'Text files' as the type in the file open dialog box). This brings up the 'Text Import Wizard' which allows you to select 'Delimited' by commas, and to select 'Text' for all the columns (select the first, scroll to last and shift-click to select all).
{{man note|Excel cannot directly save Unicode CSV files.|To save a CSV in Unicode, save to "Unicode Text (*.txt)", then open the file in Notepad++. Using Notepad++ 'Search' and replace menu, change all the tabs ('/t') to commas (','). Using Notepad++ 'Encoding' menu convert to "UTF-8-BOM" and save the file to CSV ('*.csv').
== Import ==
To import your data:
# use Use the file from above, or create a spreadsheet (described [[Gramps_4.2_Wiki_Manual_-_Manage_Family_Trees:_CSV_Import_and_Export#Example_CSV_with_multiple_areas|below]]) with genealogical data# start up Start Gramps# import Create a new Family Tree# Select from the menu {{man menu|Family Trees ->Import...}}# Select the '''Comma Separated Values Spreadsheet (CSV)''' file into your current databaseand then select the {{man button|Import}} button 
The merge part of this code will only add or update information to your database, and it always assume that the spreadsheet data is the correct version.
== Details ==
Case doesn't matterColumn names are not case-sensitive. You may use any combination of thesethe columns, in any order. (Actually, you have to at least have a surname and a given name when defining a person, you have to have a marriage and child columns when defining children, and places need a place reference, but that is it.) The column names are the English names given (for now) but the data should be in your language (including the words "male" and "female").
Order Top-to-bottom order is important in that if you want to reference something in one area to another, the definition MUST come first. For example, if you want to define families of people, the individuals must be defined before the families. The same applies to places. So it is usually best to put the Places data first, people next, then marriages and families.
Each of these can go in its own area in a spreadsheet. There is no limit to the number of areas in a sheet, and each area can have any number of rows. Leave a blank row between "areas". Just make sure that areas are not next to each other; they must be above and below one another.
You can have multiple areas of each kind on a spreadsheet. The only limitation is that if you refer to a person, you must do that in a row lower than where that person is described. Likewise, if you refer to a marriage, you must do that in a row lower than where the marriage is described. References to enclosed_by places must already exist in the database, or be defined in rows above in the spreadsheet.
If you use the 'grampsid' as a way to assign specific ids, be ''very'' careful when importing to a current database. Any data you enter will '''overwrite''' the data assigned to that grampsid. If you use ids in the place, person, marriage, or family columns that are surrounded by brackets (for example '[i0001I0001]'), the values you use will be interpreted as grampsids as well. If you are adding '''new''' items, you are encouraged to avoid use of the bracket format or grampsid columns, so as to avoid accidentally overwriting your data. If you are mixing the bracket (or grampsid) methods with plain references (no brackets), put the plain referenced data after the bracket referenced data.
If you are entering the data in a text file, and if you wish to have a comma inside one of the values, like "Clinton, Co., MO" then you need place the entire value in double-quotes and put the first double-quote right after the preceding comma. For example:
Place, Title, Name, Type
p1[P0001], Michigan, Michigan, StateL1, Canada, Canada, Countryp2L2, USA, USA, Country
Firstname, Surname, Birthdate, BirthplaceBirth place idJohn, Tester, 11/11/1965, p1L1Sally, Tester, 01/26/1973, p1L1
Person, Firstname, Surname, Birthdate, Birth place idp1, Tom, Smith, 22 Jan, 1970, [P0001]
p2, Mary, Jones
p3, Jonnie, Smith
p5, James, Loucher
p6, Penny, Armbruster
p7[P0002], Tim, Sparklet
Marriage, Husband, Wife
m1, p3
m1, p6
m2, p7[P0002]

Navigation menu