• RedDot CMS Blog
  • 29.11.2019
  • EN

rdb: Using Excel as a database source

Why not let editors who don’t work often with RedDot but daily with Excel edit their data in the environment they are used to – and let RedDot do the work?

All you need is half an hour of preparation, some definitions for the Excel format, and that’s it!

Step 1: Defining Excel as a database connection

  1. Switch to Server Manager and open the node “Administer Database Servers”.
  2. Select “Database Access Modes” and choose “Add Access Mode” from the Action Menu.
  3. Enter the following into the dialog:
    Name: XLS
    Description: Microsoft Excel
    Provider Template: Provider=”Microsoft.Jet.OLEDB.4.0″;Data Source=”<%Database|database|xls%>”;Extended Properties=”Excel 8.0″;
    Category: Jet4

Step 2: Accessing the data from your project

  1. Save your Excel file on the RedDot server. A good idea would be to upload it using the Asset Manager, since then you can offer your editors to upload newer versions at any time. The Asset Manager’s data storage must be in the file system.
  2. Switch to SmartTree view of your project and select “Administer Project Settings” – “Database Connection” and choose “Create Database Connection” from the Action Menu.
  3. Name it as desired, then select “Product” and choose “XLS” from the list. Then click “Next”.
  4. Choose your Excel from the file system.

Step 3: Publishing the content

  1. In your template, create a new database element for every column of the Excel that you want to publish. You will need to set the following:
    Database: Choose your Excel (step 2, item 3) from the list of all your database connections.
    Table: By default, an Excel document contains three tables. So it’s a good idea to delete the unused and to name the remaining uniquely.
    Field: This is the column. Line 1 will be used here.
  2. The way you output these data is up to you. RedDot offers two ways: All on one page, or one page for every fieldset (which is one line in Excel). Just set the corresponding Block Marks around you template code (Database Query or Hit List).

Definitions and Settings for the Excel

As RedDot on the one hand expects a “real” database, and on the other hand, Excel is not a “real” one, your Excel file must comply with some rules to make the whole thing run:

  1. All tables must only be named with ASCII characters,  must be named uniquely and must be “simple” tables containing just data (no formula etc.)
  2. The first line will be used as identifier of the field. No data must be written here. These names must be unique, too.
  3. Every line below will be considered as one fieldset. So there should be no empty line, all lines must follow the scheme from line 1. No extra formatting (e.g. chapter headlines) is allowed.
  4. No changes must be made with the table and column names. If that happens RedDot will lose the connection to the data field.