Well...<div><br></div><div>First you have to have your data in something like a CSV file...</div><div><br></div><div>Then you need a script which is going to iterate over each line of the CSV file, see if it can find an existing node to add data to, or else create a new node.</div>

<div><br></div><div>For PHP code iterating over each line of a CSV file, check out the code in <a href="http://drupal.org/project/node_import">http://drupal.org/project/node_import</a> module.</div><div><br></div><div>Something like this:</div>

<div><br></div><div><div>        $article_nid = get_nid(&#39;title&#39;, $article_name, &#39;article&#39;);</div><div>        if ($article_nid) {</div><div>       <span class="Apple-tab-span" style="white-space:pre">        </span>  $article_node = node_load($article_nid); </div>

<div>       <span class="Apple-tab-span" style="white-space:pre">        </span>} else {      </div><div>          $article_node = new StdClass();</div><div>        }</div><div>        $article_node-&gt;type = &#39;article&#39;;</div>

<div>        $article_node-&gt;name = &#39;Article&#39;;</div><div>        $article_node-&gt;format = 3;</div><div>        $article_node-&gt;status = 1;</div><div>        $article_node-&gt;promote = 0;</div><div>        $article_node-&gt;sticky = 0;</div>

<div>        $log = &#39;Imported by import-issue &#39; . date(&#39;g:i:s a&#39;);</div><div>...</div><div>// cck fields handled a little differently</div><div><br></div><div><div>        $article_node-&gt;field_article_publication_issue = array (</div>

<div>          0 =&gt; array(</div><div>            &#39;nid&#39; =&gt; $issue_nid,</div><div>          ),</div><div>        );</div></div><div>...</div><div><div>        // save node object</div><div>        $article_node = node_submit($article_node);</div>

<div>        node_save($article_node);</div></div><div><br></div><div>The get_nid function would be something like this (only works for fields like &#39;title&#39; that are in the {node} table itself) or a simplified version of it:</div>

<div><br></div><div><div>   /**</div><div>   * Return the nid of a node if it exists</div><div>   * </div><div>   * @param $field_name</div><div>   *   The field name upon which the query is based.</div><div>   * @param $field_name_string</div>

<div>   *   The string uniquely (in this case) </div><div>   *   identifying the node we are searching for.</div><div>   * @param $type</div><div>   *   The identifier of the content type.</div><div>   * @return</div><div>

   *   $nid or false</div><div>   */</div><div>  function get_nid ($field_name, $field_name_string, $type) {</div><div>  <span class="Apple-tab-span" style="white-space:pre">        </span> return db_result(db_query(&quot;SELECT nid FROM {node} WHERE %s = &#39;%s&#39; AND type = &#39;%s&#39;&quot;,</div>

<div>       $field_name, $field_name_string, $type));</div><div>  }</div><div><br></div></div><div>Hope that helps...</div><div><br></div><div>Victor Kane</div><div><a href="http://awebfactory.com.ar">http://awebfactory.com.ar</a></div>

<div><a href="http://projectflowandtracker.com">http://projectflowandtracker.com</a> </div></div><div><br></div><div><br><br><div class="gmail_quote">On Mon, Dec 28, 2009 at 1:11 PM, Dani Matielo <span dir="ltr">&lt;<a href="mailto:dacamat@gmail.com">dacamat@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello all, <br><br>I was wondering if anybody knows a way (a module or an already existing script) to import data into new fields for existing nodes. In other words, I have already several nodes, and what I wanted to do is to create a new field on them and import data from a cvs to them. <br>



<br>Thank you in advance,<br><br>Dani<br clear="all"><font color="#888888"><br>-- <br>Daniela de Carvalho Matielo<br><a href="http://dacamat.com.br" target="_blank">dacamat.com.br</a> | <a href="http://weblab.tk" target="_blank">weblab.tk</a> | <a href="http://lixoeletronico.org" target="_blank">lixoeletronico.org</a><br>



twitter: @danimatielo<br><br>&quot;The only people for me are the mad ones, the ones who are mad to live, mad to talk, mad to be saved, desirous of everything at the same time, the ones who never yawn or say an uncommon-place thing, but burn, burn, burn like fabulous yellow roman candles.&quot; ~ Jack Kerouac<br>




</font><br>--<br>
[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br></blockquote></div><br></div>