Uploading Data Files

It's easy to generate your site from a database. You just:
  1. Generate a text file in CSV (comma-separated values) format as described below.

  2. Using the Advanced interface, upload the file to our server.

This page explains first how to create files in the required format, and second, how to upload these files and generate your site from them.

Although this page describes the file format for database uploads in detail, you usually won't have to think about it unless something goes wrong. Most spreadsheet or database programs can generate a correct CSV file for you automatically, if you choose "Save As", then "CSV File."

We recommend that you begin by generating a small CSV file with just a few records in it. Then look at the file to make sure it is correct. (For example, that the first line has the correct field names.) When it looks correct, try uploading it as a test. Once you have uploads working for a small file, you can go ahead and upload your real data.

The file format for database uploads has two parts:
  1. The first line should contain the names of the fields in the rest of the file. The field names should be names of fields in an item (name, code, price, etc). You can also have a field called path, which says what section the item should go in.

  2. The rest of the file should consist of a series of records. Each record consists of several fields (those listed in the first line).

Here is an example of a small database file:
Cookies,F23,Chocolate Chip Cookies,4.95
Cookies,G12,Oatmeal Raisin Cookies,3.95
The first line says: The rest of this file will contain records of four fields each. The first field will be the path (the name of the section containing the item); the second will be the code (e.g. sku); the third will be the name; and the fourth will be the price.

When uploaded, this file will yield a store with one section, called Cookies, containing two items: Chocolate Chip Cookies at 4.95, and Oatmeal Raisin Cookies at 3.95.

It does not matter what order you put the fields in, so long as the field names in the first line match the records in the remaining lines. This file would have exactly the same effect as the preceding one:

F23,4.95,Cookies,Chocolate Chip Cookies
G12,3.95,Cookies,Oatmeal Raisin Cookies
Notice also that records don't have to contain values for all the fields in an item. The examples so far do not include the caption field, for example. Here is a version of the same file that does include captions:
F23,4.95,Cookies,Chocolate Chip Cookies,"These are the 
best chocolate chip cookies you have ever tasted."
G12,3.95,Cookies,Oatmeal Raisin Cookies,
This example shows two things: first, that it is ok to use linebreaks within records, if they are enclosed in quotes. Also, this example shows that you can leave a field empty. The Oatmeal Raisin Cookies have no caption.

When you include a value for some field, it should appear exactly as you would type it into the form if you were building the site by hand. So if you include the options field, for example, separate sets of options with a blank line, as follows:

Shirts,F23,Polo Shirt,"Size S M L XL

Color Marigold Taupe ""Sea Green""",22.95 Pants,P12,Chinos,"Waist 32 34 36

Inseam 30 32 34",34.95
This yields a site with two sections, Shirts and Pants, each with one item, and each item with two options.

You don't have to create sections to contain the items described in your file. They will be created automatically from the names you give in the path field.

If you want to create a site that is several sections deep, you can do it by separating section names by colons in the path field. This file

Nonfiction:Computers:Web,0-201-42379-1,HTML for Bozos,19.95
Nonfiction:Cooking:Vegetarian,0-201-41379-1,Turnips Galore,29.95
will create a section called Nonfiction, within that two sections called Computers and Cookbooks, and within those, sections called Internet and Vegetarian respectively, with one book in each.

Before you upload files, you may want to check your data for these common mistakes.

  • A missing first line. Don't forget to include the field names.

  • Missing fields within records. If you want to leave a field empty, remember to include the comma, or the remaining fields will be off by one.

  • Missing commas.

  • Colons within section names. These will be interpreted as several nested sections.

Once you have created your data file, here is how to upload it to the server:
  1. Log in with the Advanced interface.

  2. Click on [Database Upload] to get to the database upload page.

  3. Once there, click on the Upload button.

  4. Select the data file from your disk.

  5. Click on Send.

At this point you will have to wait while the data is sent to the server. It could take up to 5 minutes if you have a giant file or a slow modem. A typical 28.8k modem transmits around 3k bytes per second, so if your data file is 300k, it will take nearly 2 minutes.

When the data has arrived at the server, you will see the database upload page again. (If you get "Document contains no data" instead, it probably means there was something wrong with your data file.) It will tell you how many records were in the file, and will show you the contents of the first one.

To check the 25th record, enter 25 in the box next to the Inspect button, then click on the button. If you check the first record, the last record, and one somewhere in the middle, that will usually be enough to insure that the data is ok.

Unless you have custom types or templates, leave the defaults for Item type, Item template, etc.

Now the final step, building your site. Here you have two choices:

  1. If you want to rebuild your site, throwing away everything currently in it, click on the Rebuild button.

  2. If you just want to add the items in the data file to your site, keeping everything that is already there, click on the Add button.

If you Rebuild or Add, and then on inspecting the site you find that there was something wrong with your data, you can still get your old site back. When you click on Rebuild or Add, the previous contents of your site are saved, and you can get them back by clicking on the Revert button.

Warning: The Revert button only works once. You can't go back and get your site as it was two Rebuilds or Adds ago. So check your site after every Add or Rebuild.

As a general rule, be very, very careful. At this point, you are using the computer equivalent of a chainsaw. As well as building your site with one button click, you can destroy your whole site with one button click. So if you are not sure you want to do something, don't do it. Call us first.

What is the Bar-delimited format option?

That is Viaweb's old database format. It will still be supported for a few months for compatibility. New users should not bother with it.

Why does it say "document contains no data" when I upload my data?

Probably the field names were missing or not all on one line.

If you Add an item with the same name as an existing item, will the new one overwrite the old?

No, items are identified by their code fields. You can have two items with the same name. However, if you try to Add an item with the same code as an existing item, the new item will overwrite the existing one.

Is there a way to upload images en masse?

Yes, you can upload a zip file of images.

Is it possible to upload sections with content?

Not currently.

Can I get the contents of my site back from the server in the same format?

Not yet, but we plan to add that eventually.

Is there a limit on the size of file I can upload?

Our software will work for files up to about 14 MB. However, the browser itself may refuse to upload a file over a certain size. If you try uploading a giant file, and the browser seems to finish immediately, it was probably not sent.

Sales: 1-888-4-VIAWEB or
Support: 1-617-876-9678 or