STRIP Data Import Guide

2011-07-26 20:00:00 -0400

This Document is Out-of-Date

For the latest information and help with Codebook's Import feature visit this page.

Information about Export is also available.

We had an even earlier document here on our blog about CSV importing, but it’s also out of date.

Contents

Exporting STRIP databases from Palm OS

If you are using STRIP on Palm OS and wish to export your data to CSV for safe-keeping or for moving to another system, we have a special utility just for you: Palm STRIP Export Utility. It works on Windows and OS X (including Lion) by opening up the backup of your STRIP data files stored by Palm Desktop. Make sure you Hotsync first!

The files produced by this utility should be ready for import into current versions of STRIP for the desktop. If you run into any issues importing these files, please get in touch.

Background Information

When importing and exporting data with STRIP, it is very helpful to have a general understanding of how STRIPstores and models your data. Here is a quick run down:

Entries are the basic records. Each has a name, an icon file, a Category, and a list of associated fields, shown right on an Entry record. For instance, you might create an Entry named “Bank Account”, and create a Field for the account number, another Field for the routing number, and perhaps a third Field for your PIN.

In summary: Categories –> Entries –> Fields

A Category may have any number of Entries, and an Entry may have any number of Fields.

Each Field has a Label (sometimes we call this the “Type”, but we’ve been making an effort to be more consistent with our terminology). The Label identifies the data stored in the Field (e.g. “Password”, “Website”, “Email”), and also defines behaviors in STRIP for your convenience. For example, when you tap on a Field labeled Website in STRIP for iOS, the application will offer to launch the URL in your web browser.

Labels have a Mode that define behaviors for the label. For instance, the “Website” Label in a default install of STRIP has the mode “url”. When you tap on a Field in STRIP that has this mode, Strip will attempt to launch the value in the Field as a URL on your system. You might consider creating a label SSH for launching your favorite SSH client with your credentials in the field, e.g. sftp://user:password@hostname:22. When you create a label, the default type is “field”, which has no special behaviors. Any registered protocol handler on your system should be a valid URL scheme.

Importing data

STRIP for Windows and STRIP for OS X allow you to import data via CSV format (learn what this is here). As might be expected, each line in the file (with the exception of the header row) represents an Entry in STRIP. However, for STRIP to successfully parse your file, there are a few requirements that must be met:

  • The file must be a valid CSV file. Properly escaped data is supported.
  • The file must be encoded with Unicode (UTF-8).
  • A header row identifying all columns must be present.
  • One column must be named “Entry”, and cannot be empty for each row of data.
  • One column must be named “Category”, and cannot be empty for each row of data.

Creating new Entries

By default, STRIP on the desktop will treat every line in your CSV file as a new Entry record and create it accordingly (even if you give multiple lines the same name in the Entry field), unless the EntryID column is detected, and contains data. More on that later.

N.B. Importing the same file multiple times will result in those records being created anew each time, something that trips up a lot of users. If you wish to reset your database, see our FAQ item

In your CSV file’s header row, ensure that there is a column named Entry, and a column named Category. When STRIP imports your CSV file and inspects the Category column for a record, it tries to find a matching Category with that name that already exists in your database. This lookup is case-sensitive. If a Category with that name does not exist, one is created for you.

All other columns are treated as Fields, so that each remaining column in the header row is matched up to a Label in your database. With a default install of STRIP, you’ll find that Labels like Password and Website already exist. If no existing Label is found that matches the name of your column, STRIP will create a new one for you.

If you need to create a record that has multiple fields with the same label, simply cram each values into the same column, and separate them with the pipe character, |. For example, say you have a record that needs three emails fields—in a column labeled ‘Email’, you could include three email addresses by separating them like so:

"frank@mailinator.com|foo@bar.com|steve@apple.com"

If for some reason the pipe character is not intended to be a separator but is valid data, you can escape it by putting a backslash in front of it, like so:

The\|Oatmeal

Updating existing Entries

This feature is only supported for import on STRIP for OS X, it is not available on Strip for Windows.

When importing data into STRIP for OS X, you can add a special column to your CSV file named “EntryID”. If this column is empty for a particular row, it is simply ignored and a new Entry will be created from the row. If this column contains the GUID of an existing Entry record in your Strip database, Strip looks up the Entry matching this ID and replaces its name, Category, and Fields using the data in the rest of the row.

All versions of STRIP display the GUID for each Entry record. If you wish to export your data to a CSV field to bulk update in a spreadsheet editor like Excel, use the Export feature. The file contains the EntryID column populated for you. You can then re-import the file after making your changes, and it will cause all the listed records to be updated.

An example CSV

Here’s an example CSV file that you might use as a template for importing data. As you can see on line 2, newlines (line-breaks) are allowed in field data as long as the field is properly escaped with double-quotes.

Entry,Category,Account,Email,Note,Password,Phone,PIN,show,Username,Website
Credit Card,Financial,3759 876613 21001,,"exp:12/12
CVV:3829",secret,1-800-123-4567,4,,mscott,http://mycreditcard.com
Insurance Policy,Financial,3759 876613 21001,,secret: name of your first pet? spot,secret,1-800-123-4567,4,,mscott,http://myinsurance.com
jordie laforge,trekkers,,,,,,,nextgeneration|deep space nine,,
kirk,trekkers,,,,,,,star trek,,
patrick stewart,trekkers,,,,,,,star trek|next\|generation|voyager,,
riker,trekkers,,,,,,,,,
Shopping Website,Personal,,mscott@mailinator.com,,secret,,,,,http://paypal.com

Our import and CSV processing is based on the scanning technique and EBNF outlined by Matt Gallagher to fully support properly escaped CSV data.

If one were to extend that EBNF definition to take into account our use of | to separate multiple field values, we think it would look like this:

file = [header lineSeparator] record {lineSeparator record}
header = name {separator name}
record = field {separator field}
name = field
field = escaped | nonEscaped
escaped = doubleQuote {innerField | separator | lineSeparator | twoDoubleQuotes} doubleQuote
nonEscaped = innerField
doubleQuote = '"'
twoDoubleQuotes = '""'
separator = ','
lineSeparator = ('\r' | '\n') {'\r' | '\n'}
innerField = textData { innerFieldSeparator | textData }
innerFieldSeparator = '|'
textData = {characters up to the next double quote character, un-escaped innerFieldseparator, separator string, or lineSeparator}

What happens when there's an error?

STRIP imports your data in a transaction. If anything goes wrong during the data import, the entire transaction is rolled back and your STRIP database is restored to its original state, from before the import operation.

If you’re missing data on a row (say the Category or Entry column is blank), STRIP will endeavor to tell you the line number so you can easily fix it.

Encoding Errors | My file is not in Unicode (UTF-8)

Unicode was a brave effort to create a single character set that included every reasonable writing system on the planet and some make-believe ones like Klingon, too. ~Joel Spolsky

Not all text files are alike. These days, most text files, and most websites, are encoded in what’s called UTF-8. In fact, when you type text into a form in a modern web-browser, you are typing in UTF-8 (unless you’ve done something to change that behavior). For this reason, when STRIP reads your CSV file, it expects it be encoded in UTF-8.

You don’t need to know what that is or means, really. But if you have a file from another system, say a CSV file from another password manager product, and you run into an encoding error during import, there’s an easy fix: just change the encoding!

It’s a simpler operation than you might think, and most text editors support it: Simply open up your CSV file in your favorite text editor, go to the Save As dialog, and look for an “Encoding” drop down, and select Unicode (UTF-8). You can even do this in Excel.

Resetting STRIP | When imports go wrong

This data import thing can be tricky. If it didn’t work the way you wanted it to and you want to try again, you have options.

If you are using STRIP for Windows, or Strip for OS X, your best best is to simply delete all the data added in the interface, and adjust your CSV file for another shot at it. If you don’t, you’ll start to end up with duplicates. If you would instead rather delete the data file and reset the application, you can find it in the following locations:

Windows %APPDATA%\Zetetic LLC\Strip\strip.db
OS X /Users/username/Library/Containers/net.zetetic.Strip.mac/Data/Library/Application Support/Strip/default.strip

On OS X, the Library folder is hidden, but you can navigate to the parent folder in the Finder by selecting Go -> "Go to Folder..." (Shift+Cmd+G), and entering the following into the location field:

~/Library/Containers/net.zetetic.Strip.mac/Data/Library/Application Support/Strip

For Windows, simply paste that location into the location bar in Windows Explorer. After trahsing the database file, start Strip up again, and you’ll be asked to set a new password so it can create an empty database for you.