## 8.3. Drupal Import Guide

Before you can import a book, you need to install a module call 'Node Import' in Drupal. This module allows Drupal to import and update content from CSV or TSV files. To install this module, simply go to drupal site and follow the instructions on the website to download it. Once this is done, then you need to copy the downloaded module to the 'modules' directory on the Drupal server. For example if your Drupal is located in `/var/www/html/drupal/` directory, then you should copy the module to `/var/www/html/drupal/sites/all/modules/` directory. To enable the installed module, login to the Drupal site and go to Administer -> Site building -> Modules . In the Development section, tick the checkbox and click Save configuration button to activate the Node Import Module.

Important — Enable Drupal Core Modules

You also need to enable the following Drupal core modules:

- Book

- Menu

- Path

Permission to install Module

Please consult your web adminstrator if you don't have permission to install module in drupal.

### 8.3.1. How to add a menu block

You can specify which menu the book should be showing in Drupal. If the specified menu block doesn't exist, Drupal will throw all the imported contents in the primary link. Therefore, if you wish to list your book in a menu block, make sure you create one before importing the book. To add a new menu block, simply login to your Drupal site and go to Administer -> Menus -> Add menu .

- Menu name - The unique name for the menu. This is the value that you should set for the `drupal_menu_block` parameter in `publican.cfg`.

- Title - The title of the menu. It will be displayed on top of the menu block.

### 8.3.2. Setting up Node import

- Import directory - Where the CSV files to be imported are stored. The default path is `sites/default/files/imports/` .

- FTP settings

  - Allow FTP uploads - Make sure the checkbox is checked, so that the new CSV file can be auto-detected when it is uploaded into the `import directory`.

  - File owner - The CSV file that you uploaded to the `import directory` will be assigned ownership to this user.

    Important — File Ownership

    Users will only be allowed to use files they have uploaded themselves and files owned by anonymous. If you leave this field blank, all files uploaded by FTP will be owned by anonymous and so all users will see those files as being available for them. If you enter a username here, files that are uploaded using FTP will be owned by that user and only that user will be able to see those uploaded files. It is recommended to leave this field blank.

- Allowed extensions - The allowed import file's extension. Other extensions will be ignore by the module.

- Default settings

  - Content type - The default content type that will be used for quick import. Make sure the `Book Page content type` is checked.

  - First row contains column names - This tells the node import module that the first row of the csv file is the headers.

### 8.3.3. How to import book

Procedure 8.1. To import book into Drupal:

1. Follow the steps in Section 8.1, “How to build a CSV file for Drupal import”

2. Upload the CSV file to `import Directory` in the Drupal Server

3. Upload `en-US` directory to the `"sites/default/files/"` directory in the Drupal server. This value can be overriden in the `publican.cfg`. For more details, please read Section 8.2, “The publican.cfg file”

4. Login to the Drupal website, and go to Administer -> Content management -> Import content. You will see the CSV file that you just uploaded is showing in the 'Pending Tasks" table and it is ready to import.

5. Click Import now to start importing book. You will be redirect to the next page which is showing the import progress. When the progress bar hit 100%, that means the import is done!

6. The book link should be showing in the specified menu block now.

### 8.3.4. How to update book

Simply repeat the steps in Section 8.3.3, “How to import book” to update the book.

Warning — Section Chunking

If you update the book with smaller chunks, than the missing chunks will be deleted by Drupal and the URL path for the deleted chunks will be deleted as well.