Changes

Jump to: navigation, search
m
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))
{{grampsmanualcopyright}}
 
{{man index|Gramps 4.2 Wiki Manual - Manage Family Trees|Gramps 4.2 Wiki Manual - Probably Alive|4.2}}
 
{{languages|Gramps_4.2_Wiki_Manual_-_Manage_Family_Trees:_CSV_Import_and_Export}}
 
{{#vardefine:chapter|5.1}}
{{#vardefine:figure|0}}
 
{{out of date|The behavior of the program has changed in some points}}
== Gramps Spreadsheet Import/Export ==
{{man note|New feature since Gramps 3.3|Previously, sources were not exported, but now they are. Sources are referred to by their title text. You can add further details to a source after importing.}}
{{man note|New feature since Gramps 4.2.1|Now you can export and import place information. Also, you can refer to places in marriage and person sections by using a "place id". See below for more details.}}
There are three main uses for this format:
# You can export your core gramps Gramps data into a spreadsheet format, edit it with a text or spreadsheet program, and import the changes and additions back into grampsGramps. This is handy for sending to others to fill in, or for taking on the road when you don't have your full gramps Gramps application.# You can import new data into your gramps Gramps database. For example, if you have a set of new people to add to your database, but don't want to hunt and peck your way to finding where they go, you might find it easier to type them into a spreadsheet, and then quickly bring all of them in at once. This is handy if you have a large amount of data that you are cutting and pasting from another application or the web. An example of this is [[Narrative_Website_Import|restoring your Gramps database]] by loading the Narrative Website into a spreadsheet.
# You can also import a set of corrections and additions. Say that you have printed out a report, and you are going through it marking corrections. If you make each correction a section of a spreadsheet, you can "script the edits" and then execute them all at once.
To export your database:
# Start grampsGramps# 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, and places. The exported fields and column names are:
;IndividualsPlaces: Person, Lastname, Firstname, Callname, Suffix, PrefixPlace, Title, Gender, Birthdate, Birthplace, Birthsource, Baptismdate, Baptismplace, Baptismsource, DeathdateName, DeathplaceType, DeathsourceLatitude, BurialdateLongitude, BurialplaceCode, BurialsourceEnclosed_by, NoteoteDate
;Individuals: Person, Lastname, Firstname, Callname, Suffix, Prefix, Title, Gender, Birthdate, Birthplace (or Birthplaceid), Birthsource, Baptismdate, Baptismplace (or Baptismplaceid), Baptismsource, Deathdate, Deathplace (or Deathplaceid), Deathsource, Burialdate, Burialplace (or Burialplaceid), Burialsource, Note ;Marriages: Marriage, Husband, Wife, Date, Place(or Placeid), Source, Note
;Families: Family, Child
;Places: Places, Title, Name, Type, Latitude, Longitude, Code, Enclosed_by, Date The first column in each area is the gramps Gramps ID. That is what will tie your edits back to the correct data, so don't alter those data. Load this file into your favorite spreadsheet using comma separated, double-quote text delimited, and Text format (any encoding for now). Then you can add or correct data, and save it back out, keeping the same format. You can then import the data back on top of your old data and it will be corrected.
{{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 (eg, Excel) 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 grampsStart Gramps# Create a new Family Tree# Select from the menu {{man menu|Family Trees ->Import...}}# 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.
The spreadsheet is data made up of columns. Each column should have at the top of it the name of what type of data is in the column. You must use special names for the columns. Currently they are:
 
=== Place ===
 
<pre>
place - a reference to this place
title - title of place
name - name of place
type - type of place (eg, City, County, State, etc.)
latitude - latitude of place
longitude - longitude of place
code - postal code, etc.
enclosed_by - the reference to another place that encloses this one
date - date that the enclosed_by place was in effect
</pre>
=== People ===
birthdate - date of birth
birthplace - place of birth
birthplaceid - place id of birth
birthsource - source title for birth
baptismdate - date of baptism
baptismplace - place of baptism
baptismplaceid - place id of baptism
baptismsource - source title of baptism
grampsid - give a particular gramps id
deathdate - date of death
deathplace - place of death
deathplaceid - place id of death
deathsource - source title for death
deathcause - cause of death
burialdate - date of burial
burialplace - place of burial
burialplaceid - place id of burial
burialsource - source title of baptism
</pre>
date - the date of the marriage
place - the place of the marriage
placeid - the place id of the marriage
source - source title of the marriage
note - a note about the marriage/wedding
</pre>
==Details = Place === <pre>places - a reference to this placetitle - title of placename - name of placetype - type of place (eg, City, County, State, etc.)latitude - latitude of placelongitude - longitude of placecode - postal code, etc.enclosed_by - the reference to another place that encloses this onedate - date that the enclosed_by place was in effect</pre>
== Details ==Column names are not case-sensitive. You may use any combination of the 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").
Case doesn't matter. You may use any combination of theseTop-to-bottom order is important in that if you want to reference something in one area to another, in any orderthe definition MUST come first. (Actually For example, if you have want to at least have a surname and a given name when defining a persondefine families of people, you have the individuals must be defined before the families. The same applies to have a marriage and child columns when defining children, and places need a place reference, but that . So it is it.) The column names are the English names given (for now) but usually best to put the Places data should be in your language (including the words "male" first, people next, then marriages and "female")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 '[I0001]'), 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:
<pre>
marriage, person1parent1, person2parent2, place
m1, p1, p2,"Clinton, Co., MO"
m2, p3, p4,"Havertown, PA"
Notice that the data need not begin in the first column, nor in the first row.
And here is the resulting data in grampsGramps:
[[File:Example imported Family Tree-test.csv-41.png|thumb|left|650px|Fig. {{#var:chapter}}.{{#vardefineecho:figure|{{#expr:{{#var:figure}}+1}}}}]]
{{-}}
=== Example CSV with multiple areas ===
Here is an example of a CSV text spreadsheet with multiple areas:
<pre>
FirstnamePlace, SurnameTitle, BirthdateName, TypeJohn[P0001], Michigan, TesterMichigan, 11/11/1965StateSallyL1, Canada, Canada, CountryL2, USA, TesterUSA, 01/26/1973Country
Firstname, Surname, Birthdate, Birth place idJohn, Tester, 11/11/1965, L1Sally, Tester, 01/26/1973, L1 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 Place, Title, Name, Typep1, Canada, Canada, Countryp2, USA, USA, Country[P0002]
</pre>
If you cut and paste that into a file (or use the [[ImportGramplet|Import Gramplet]]), you can import it directly.
A date can be any valid Gramps date, including dates formats like "26 JAN 1973" or "26.1.1973".
If you make your references be gramps Gramps IDs inside square brackets, then you can refer to people already in the database, like this:
<pre>
</pre>
This example would create and add Harry Smith to the previously existing family in grampsGramps, family F1524.
Also, this example would marry two previously existing people, I0123, and I0562.
Notice that you can use numbers or strings as the reference names between areas. In the person area, I used the numbers 1 through 16. That made it easy to refer to them in the second area of marriages. The marriages are labeled with the letters A through H.
Also note that the children in the third area are existing people as indicated by the brackets around the Gramps IDs.
{{man note|LibreOffice allows you to turn off auto-formatting when you open the Saving as CSV file|If you don't do this, LibreOffice may interpret the dates incorrectly. Change the type of and importing into Gramps produces the far right-hand column to '''Text''' rather than '''Standard.''' If your spreadsheet program doesn't allow you to format in the fields before you get it into columns (eg, Excel) 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}}.}}tree:
Also note that the children in the third area are existing people as indicated by the brackets around the gramps IDs.
Saving as CSV and importing into gramps produces the far right-hand column in the tree:  [[Image:Gen5-gramps.jpg|thumb|left|500px|Fig. {{#var:chapter}}.{{#vardefineecho:figure|{{#expr:{{#var:figure}}+1}}}} Saving as CSV and importing into gramps Gramps produces the far right-hand column in the tree.]]
{{man index|Gramps 4.2 Wiki Manual - Manage Family Trees|Gramps 4.2 Wiki Manual - Probably Alive|4.2}}
{{grampsmanualcopyright}}
[[Category:Documentation|C]]

Navigation menu