1

I'm trying to add a +2000 video database (stored on youtube) to my website. I have an excel file with on every line the video title, the url and the keywords.

Is there an easy way to automate this process rather then copy pasting +2000 times in to new nodes?

Kind regards!

2

You can use view inside node and Feed Import

2

You can achieve that using the Feeds module

Import or aggregate data as nodes, users, taxonomy terms or simple database records.

  • One-off imports and periodic aggregation of content
  • Import or aggregate RSS/Atom feeds
  • Import or aggregate CSV files
  • Import or aggregate OPML files
  • PubSubHubbub support
  • Create nodes, users, taxonomy terms or simple database records from import
  • Extensible to import any other kind of content
  • Granular mapping of input elements to Drupal content elements
  • Exportable configurations
  • Batched import for large files

This article might help you to achieve this.

0

Piece of cake!

First of all here is a question I have recently answered on how to import content from .CSV file and create nodes using the feeds module. You can develop a solution with this answer as a helper.

Alternatively you can instruct your FEED module to get the videos from youtube directly rather than having the EXCEL middleman. You need to make use of the Youtube Feeds Parser Module and the modules it REQUIRES.

Once you have enabled the youtube feeds module, you should have access to an extra parser which would allow you to map fields of the content type to specific metadata of youtube videos. You can then hook this Feed Importer into a content types and instruct the CRON to run it automatically in the background - magic.

See the review of Youtube Feeds Parser here

0

Another approach (with custom module): 1. install YouTube Field, add new field(YouTube video) to your content type. 2. install PHPExcel module. 3. create simple custom module (.module file with single hook_enable function):

function MYMODULE_enable()
{
  module_load_include('inc', 'phpexcel');
  $path = 'sites/default/files/MYFILE.xls';
  $result = phpexcel_import($path);
  if (is_array($result)) {

    foreach ($result as $key => $value) {
      // here you need to know what's being returned by $value (you can use dpm() function from Devel module to debug the $result array).. I assume it's an object
      $node = new stdClass();
      $node->type = 'MY_TYPE';

      node_object_prepare($node);

      $node->title = $value->title;
      $node->MY_YOUTUBE_VIDEO_FIELD_NAME['und'][0]['value'] = $value->url;

      node_save($node);
    }

  }
  else {
    drupal_set_message(t('Oops ! An error occured !'), 'error');
  }
}

hook_enable is launched only once when you enable your module (I am using it here to prevent launching tnat piece of code unnecessarily).. If you want you can run that snippet at any request (without hook_enable), or from separate file (outside or inside of drupal by drush scr).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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