Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

How would you go about creating a large number of nodes from a large number of html documents?

I am trying to create something similar to a book and have a lot of .docx files on my computer. I am aware I should use a wysiwyg editor to clean up the formatting and make it look like I want saving it as HTML. However there is the issue of getting all the .html files uploaded as nodes without having to copy-paste 200+ times.

Any ideas?

share|improve this question

3 Answers 3

up vote 9 down vote accepted

The module that appears as most suitable for you is called HTML2Book. It will automatically create a new book page for each HTML heading and subheading in the body text. This makes it possible to use a single HTML page, created in a word processing program and saved as HTML, or other structured HTML, to create a multipage Drupal book in a single step. You actually need to collate all your .docx files into a single HTML-file before converting to HTML to use HTML2Book in a single step.

In case your requirements are beyond what HTML2Book is capable of, below is a list of all the (usable) Drupal modules I am aware of that can be used to bulk import HTML (and some other formats) into a Drupal site:

  1. HTML2Book - Import a single HTML page and split it up into an hierarchical Drupal book structure consisting of a set of interlinked Drupal nodes.
  2. Import HTML - Import all of an existing, static HTML-site into a Drupal site as nodes.
  3. Feeds - Import or aggregate data as nodes, users, taxonomy terms or simple database records.
  4. Migrate - Provides a flexible framework for migrating content into Drupal from other sources, including HTML.
  5. Node import - Allows users to import content (node, user, taxonomy) from CSV or TSV files. Requires you to convert from HTML to CSV. (no Drupal 7 version)

Of these, the simplest to use is HTML2Book, but it can only handle a single HTML page. For more complex conversion tasks, where you need to convert a large static HTML-site made up of several interlinked pages, one of the other modules may be more suitable.

Also: Whatever tool you use, never experiment with bulk import on a production site. Unless you're a lot more clever than me, there are going to be false starts and botched imports. Cleaning up thousands of nodes damaged by an import gone wrong is not fun. Always experiment with bulk import on a throwaway staging site that just can be discarded wholesale when things go wrong. Transfer the settings and do the import on the production site when you're sure you have a working set-up.

share|improve this answer
    
Thank you for the thorough answer! However I am using drupal 7 and already have a site set up (took quite a while to configure it.. so I am very much against creating a new drupal site). Feeds seems to be the only real option, however it seems very complex to use. Could you possibly elaborate on its use or are there any tutorials that are easy to read for a time-pressed fellow? –  Ithxi May 14 at 6:03
1  
@Ithxi, I've used Feeds for a number of bulk import projects and to import HTML. make sure you tick "Allow all HTML tags". I am not aware of any tutorials describing the process in detail. This site is for basic Q&A, not detailed tutorials (nor do I have the time to write one). Feeds is indeed a beast that has rather rough edges. On the other hand, installing a throwaway Drupal 6 on localhost is (IMHO) quick and simple. If I had to choose between configuring Feeds to import HTML, and to set up a throwaway Drupal 6, I would opt for the latter. –  Free Radical May 14 at 6:11
    
I suppose it is an answer. But jeez it is horrible that there isn't a better way to do this? Someone must have faced the same issue and created a solution... Thanks for the answer though - I will mark it as answered in a couple of hours if no other answers show –  Ithxi May 14 at 19:12

If you have a lot of docx files(which you do), then it is really worth the effort to write a custom migration class using the migrate module. Something similar has been done before and documented.

share|improve this answer

Here is a nice tutorial for learning how to use feeds. It is really quite straightforward. http://mustardseedmedia.com/podcast/episode55

Please note that it doesn't cover how to import html docs but it should get you pretty far down the road.

Also, you really should learn how to use backup and migrate module ( https://drupal.org/project/backup_migrate) so you can easily backup and restore your database if you break something. I would also recommend you take the time to setup an extra copy of your site that you can experiment on. It is very frustrating when you break something and can't find your way back.

Selwyn

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.