Spreadsheet data
import & export

  1. Introduction
  2. Excel download
  3. CSV download/export
  4. CSV upload/import

Introduction

Every collection in an Alan app can be downloaded as an Excel or CSV file, and can take data back in from a CSV file. Both live in the menu behind the ≡ icon in the header of the collection: Download for Excel and CSV, Import CSV for the other direction.

The collection menu, with Download and Import CSV

Excel download

Download → Excel gives you an .xlsx file with the data of the collection as the app shows it, derived values included. The download applies the filter that is active in the app, so searching first exports a subset.

CSV download/export

Download → CSV gives you a file with the base data of the collection — the data a user enters, without derived values, since those are computed from the model and cannot be imported.

For example, for the application from the figure, a CSV download gives you a file with these contents:

Products,item_operation,Description:,Type?,Type_operation?,Price#Simple*Type?
Car,update,A vehicle that can drive you places.,Assembled,update,
Steering wheel,update,A steering wheel for a car.,Simple,update,209.99
Tire,update,A car part.,Simple,update,25

CSV upload/import

Import CSV asks for a file and loads it into the collection. The contents have to follow a specific format. The CSV file that you can download, specifies this format. Specifically, it shows you for which columns you need to provide values. If you upload a CSV file that contains errors, you will get an error report explaining what should be fixed.

To explain the data format requirements, let’s look at the CSV data from the Products collection. The first column is for the key of Products items. Keys of collection entries have to be unique: you cannot add multiple Products with the same key.

For the second column, the item_operation, you can choose from:

For the stategroup Type of the Products, you see a column Type_operation?. Two different operations are supported for stategroups:

For new Products (when the item_operation is add), you need a blank field.

The notation for number values is identical to the input format that the app expects. For example, if you can enter a price with two decimal places in your app then you should provide numbers with (at most) two decimal places in your CSV. That is, unless numbers use a dynamic number of decimals in your app. In that case, you should provide number values without decimals.

Some examples of updates for the Products collection: