taxonomy_csv.help.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Taxonomy CSV import/export help</title>
  7. <style type="text/css"><!--
  8. h3 {
  9. font: bold 120% sans-serif;
  10. }
  11. h4 {
  12. font: bold 100% sans-serif;
  13. margin-top: 24px;
  14. margin-left: 18px;
  15. }
  16. h5 {
  17. font: italic 100% sans-serif;
  18. margin-top: 8px;
  19. margin-left: 36px;
  20. }
  21. table {
  22. width: 80%;
  23. }
  24. table,
  25. div.codeblock {
  26. border: 1px solid rgb(204, 204, 204);
  27. padding: 4px;
  28. background-color: rgb(238, 238, 238);
  29. margin: 6px 48px 12px 24px;
  30. }
  31. code {
  32. white-space: pre;
  33. }
  34. --></style>
  35. </head>
  36. <body>
  37. <p>This module allows to import/export taxonomies, structures or simple lists of terms into/from a vocabulary from/to a <a href="http://en.wikipedia.org/wiki/Comma-separated_values" title="Wikipedia definition">CSV</a> file, a url or a copy-and-paste text.</p>
  38. <p>CSV format is a simple list of values separated by a delimiter, often comma (<strong><code>,</code></strong>) or semicolon (<strong><code>;</code></strong>), and enclosures, often quotation marks (<strong><code>"</code></strong>). If you are unsure how to create a CSV file, you might want to use <a href="http://www.libreoffice.org" title="LibreOffice.org">LibreOffice Calc</a> or another spreadsheet application to export your data into a CSV file.</p>
  39. <p>Specific import or export formats can be added simply by a plug-in mecanism (or ask author!).</p>
  40. <p>After enabling the module, permissions "import taxonomy by csv" and "export taxonomy by csv" need to be set. Main "administer taxonomy" permission is not needed to use module, but this is recommended.</p>
  41. <p>Internationalization is supported, except for attached Fields [Taxonomy CSV pour Drupal 7 only]. So you can import a list or a structure of terms, then translate them.</p>
  42. <p>This module supports <a href="https://drupal.org/project/drush">drush</a> and allows to import or to export taxonomies by csv with command line interface.</p>
  43. <p>Taxonomy CSV for Drupal 7 has got a simpler UI compared to the version for Drupal 6, because taxonomy has been reworked with fields in Drupal 7. Help for Drupal 6 version is available in <a href="https://drupalcode.org/project/taxonomy_csv.git/blob_plain/refs/heads/6.x-5.x:/taxonomy_csv.help.html">English</a> or in <a href="https://drupalcode.org/project/taxonomy_csv.git/blob_plain/refs/heads/6.x-5.x:/taxonomy_csv.help.fr.html">French</a>.</p>
  44. <div class="toc">
  45. <h2 class="nonum"><a id="contents" name="contents">Table of Contents</a></h2>
  46. <ol class="toc">
  47. <li>
  48. <a href="#formats">Formats</a>
  49. <ol class="toc">
  50. <li>
  51. <a href="#structure">Structure</a>
  52. <ul>
  53. <li>
  54. <a href="#flat">Terms (flat vocabulary)</a>
  55. </li>
  56. <li>
  57. <a href="#tree">Hierarchical tree structure or one term by line structure</a>
  58. </li>
  59. <li>
  60. <a href="#polyhierarchy">Polyhierarchical structure</a>
  61. </li>
  62. </ul>
  63. </li>
  64. <li>
  65. <a href="#fields">Fields</a>
  66. <ul>
  67. <li>
  68. <a href="#fields_format">Fields CSV format</a>
  69. </li>
  70. <li>
  71. <a href="#fields_custom">Autocreation of Fields</a>
  72. </li>
  73. </ul>
  74. </li>
  75. <li>
  76. <a href="#translate">Term translation</a>
  77. </li>
  78. </ol>
  79. </li>
  80. <li>
  81. <a href="#import">Import</a>
  82. <ol class="toc">
  83. <li>
  84. <a href="#import_content">What to import (content of the source)?</a>
  85. </li>
  86. <li>
  87. <a href="#source">Where are terms to import?</a>
  88. </li>
  89. <li>
  90. <a href="#file_format">How is formatted your source?</a>
  91. </li>
  92. <li>
  93. <a href="#destination">Which vocabulary do you want to import into?</a>
  94. </li>
  95. <li>
  96. <a href="#import_options">When a term exists, what to do with it?</a>
  97. </li>
  98. <li>
  99. <a href="#info_process">Informations on process and big taxonomies import</a>
  100. </li>
  101. </ol>
  102. </li>
  103. <li>
  104. <a href="#export">Export</a>
  105. </li>
  106. <li>
  107. <a href="#import_api">Drush and Taxonomy csv import API</a>
  108. </li>
  109. <li>
  110. <a href="#advanced_options">Advanced settings and hints</a>
  111. <ol class="toc">
  112. <li>
  113. <a href="#permissions">Permissions</a>
  114. </li>
  115. <li>
  116. <a href="#other_hints">Other hints</a>
  117. </li>
  118. </ol>
  119. </li>
  120. </ol>
  121. </div>
  122. <h3 id="formats"><a href="#contents">1. Formats</a></h3>
  123. <p>Multiple formats can be used to import or export vocabulary. Except with some formats, the first column contains the term name. You can specify what you want to export and how additional columns should be imported.<br />
  124. <p>To import a complex taxonomy, it's recommended to import terms in this order:</p>
  125. <ul>
  126. <li>Structure (flat, tree or polyhierarchical)</li>
  127. <li>Fields (name, weight, description, parent and what you want)</li>
  128. <li>Translation (if <a href="https://drupal.org/project/i18n">i18n</a> is installed)</li>
  129. </ul>
  130. <p>That's what you can choose in the first tab.</p>
  131. <h4 id="structure"><a href="#contents">1. Structure</a></h4>
  132. <h5 id="flat"><a href="#contents">1. Terms (flat vocabulary)</a></h5>
  133. <p>Use this option to import a lot of terms in order to create a flat vocabulary. All items in your file will be imported as terms. Example:</p>
  134. <div class="codeblock"><ul>
  135. <li><code>Clothes, Trees, Houses</code></li>
  136. <li><code>Paris, Drupal</code></li>
  137. </ul></div>
  138. <h5 id="tree"><a href="#contents">2. Hierarchical tree structure or one term by line structure</a></h5>
  139. <p>Use this option to create a tree structure of a vocabulary (geography, classification...). To import a hierarchy with multiple parents as a genealogical one, it's advised to use "Polyhierarchy", "First level children" or "First level parents" imports.</p>
  140. Your file can be written with two schemes and a mixed one.<br />
  141. <h6 id="tree_structure_full_line"><a href="#contents">First scheme: Full ancestors of a term</a></h6>
  142. In the first scheme, you need to set all ancestors to each term. The second column will be imported as the name of a child term of the term defined by the first column. The third column will be imported as a child of the second column, and so on. Lines can have any order. Example:<br />
  143. <div class="codeblock"><ul>
  144. <li><code>Animal, Mammal, Whale</code></li>
  145. <li><code>Animal, Mammal, Monkey</code></li>
  146. </ul></div>
  147. Be careful: when a child is added or updated, line should contain all its ancestors. So a third line may be:<br />
  148. <div class="codeblock"><ul>
  149. <li><code>Animal, Mammal, Human</code></li>
  150. </ul></div>
  151. <strong>but not</strong>:
  152. <div class="codeblock"><ul>
  153. <li><code>Mammal, Human</code></li>
  154. </ul></div>
  155. because in this second case, &lt; <code>Mammal</code> &gt; is imported as a first level term and not as a &lt; <code>Animal</code> &gt; term child as in previous line.
  156. <h6 id="tree_structure_partial_line"><a href="#contents">Second scheme: One term by line</a></h6>
  157. In the "one term by line structure" scheme, you can import terms without duplicate all its ancestor if previous term has ancestors. It is very useful with a spreadsheet application. It allows to easy build a structure and to upload a less heavy file. So your hierarchy can be:<br />
  158. <code><table border="1">
  159. <tr><td>World</td><td></td><td></td><td></td></tr>
  160. <tr><td></td><td>Asia</td><td></td><td></td></tr>
  161. <tr><td></td><td></td><td>Japan</td><td></td></tr>
  162. <tr><td></td><td></td><td></td><td>Tokyo</td></tr>
  163. <tr><td></td><td></td><td>Korea</td><td></td></tr>
  164. <tr><td></td><td></td><td></td><td>Seoul</td></tr>
  165. </table></code>
  166. <br />
  167. So, first lines of your csv file can be:
  168. <div class="codeblock"><ul>
  169. <li><code>World</code></li>
  170. <li><code>,Asia</code></li>
  171. <li><code>,,Japan</code></li>
  172. <li><code>,,,Tokyo</code></li>
  173. <li><code>,,Korea</code></li>
  174. <li><code>,,,Seoul</code></li>
  175. </ul></div>
  176. <div class="codeblock"><ul>
  177. <li><code>,Europe</code></li>
  178. <li><code>,,France</code></li>
  179. <li><code>,,,Paris</code></li>
  180. </ul></div>
  181. <div class="codeblock"><ul>
  182. <li><code>,,Italia,Abruzzo,Chieti,Chieti</code></li>
  183. <li><code>,,,,,Civitaluparella</code></li>
  184. </ul></div>
  185. &lt; <code>Paris</code> &gt; will be automatically added as a child of &lt; <code>France</code> &gt; and so on.
  186. <h6 id="tree_structure_mixed_line"><a href="#contents">Mixed scheme</a></h6>
  187. <p>Partial lines are allowed, so a next line can be:</p>
  188. <div class="codeblock"><ul>
  189. <li><code>,,Switzerland,Bern</code></li>
  190. </ul></div>
  191. &lt; <code>Switzerland</code> &gt; will be added as a child of &lt; <code>Europe</code> &gt; and of course &lt; <code>Bern</code> &gt; as a child of &lt; <code>Switzerland</code> &gt;.
  192. <p>In same way, above lines can be simplified to:</p>
  193. <div class="codeblock"><ul>
  194. <li><code>World, Asia, Japan, Tokyo</code></li>
  195. <li><code>,, Korea, Seoul</code></li>
  196. <li><code>World, Europe, France, Paris</code></li>
  197. </ul></div>
  198. Full lines, partial and one term lines can be mixed, but order is important two by two lines, except when there are only full lines. In this example, if fifth and sixth lines are shift, &lt; <code>Seoul</code> &gt; will become a child of &lt; <code>Japan</code> &gt;.
  199. <h5 id="polyhierarchy"><a href="#contents">3. Polyhierarchical structure</a></h5>
  200. <p>Use this option to create a a polyhierarchical structure, as a genealogy.<br />
  201. Format is the same than tree structure: each term is the child of previous item: parent, child, sub-child... and so on.<br />
  202. There are four differences. First, the first item doesn't need to be a root. Second, duplicate terms are always merged, except when one is the direct parent of the other one, because it's forbidden in Drupal. So, if the vocabulary is monohierarchical and without non-direct duplicate terms, as in the previous geographical example, result is the same than with previous option. Third, lines can be partial too, but in some case of duplicates, result may differ. Last, polyhierarchy can be recursive.<br />
  203. For example, lines may be:</p>
  204. <div class="codeblock"><ul>
  205. <li><code>Grand-Mother, Mother, Daughter</code></li>
  206. <li><code>Grand-Father, Mother, Son</code></li>
  207. <li><code>Grand-Mother 2, Father, Daughter</code></li>
  208. <li><code>Grand-Father 2, Father, Son</code></li>
  209. <li><code> , , Son 2</code></li>
  210. <li><code> , Uncle</code></li>
  211. <li><code>Grand-Mother 2, Uncle</code></li>
  212. <li><code>Father, Son 3</code></li>
  213. </ul></div>
  214. <h4 id="fields"><a href="#contents">2. Fields</a></h4>
  215. <p>Terms are imported with a csv scheme provided by the user.</p>
  216. <h5 id="fields_format"><a href="#contents">1. Fields CSV format</a></h5>
  217. <p>The csv scheme should contain each column header of the csv input. The column header is the name (not the label) of the field where to import items into. It can be a default header (name, description, weight, vid, vocabulary_machine_name, guid) or a custom field. The first item is always the name or the tid of a term.</p>
  218. <p>For example, you want to import a list of car makers, and you would like each car maker to have custom fields indicating nationality and date of origine(<a href="https://drupal.org/node/1027068#comment-4152194">origine of example, fictional</a>):</p>
  219. <div class="codeblock"><ul>
  220. <li><code>[Taxonomy Term] - [Custom Field] - [Custom Field]</code></li>
  221. <li><code>Car Maker - Country - Year Started</code></li>
  222. <li><code>-------------------------------------------------</code></li>
  223. <li><code>Ford - US - 1900</code></li>
  224. <li><code>Renault - France - 1901</code></li>
  225. <li><code>Toyota - Japan - 1902</code></li>
  226. <li><code>Nissan - Japan - 1903</code></li>
  227. <li><code>Daimler Benz - Germany - 1904</code></li>
  228. </ul></div>
  229. <p>So, with 'Fields' format, you can set your format:</p>
  230. <div class="codeblock">
  231. <code>name, field_country, field_year_started</code>
  232. </div>
  233. <p>or more generically:</p>
  234. <div class="codeblock">
  235. <code>name, field_mycustomfield_1_machinename, field_mycustomfield_2_machinename...</code>
  236. </div>
  237. <p>Items can be repeated for multivalued fields.</p>
  238. <div class="codeblock">
  239. <code>name, description, weight, parent, synonym, synonym, synonym, related_term, related_term, related_term, related_term</code>
  240. </div>
  241. <p>The module supports all field types as long as they have a 'value' in their definition. These fields has been checked:
  242. <ul>
  243. <li><code>text</code></li>
  244. <li><code>text_long</code></li>
  245. <li><code>text_with_summary</code></li>
  246. <li><code>number_decimal</code></li>
  247. <li><code>number_integer</code></li>
  248. <li><code>number_float</code></li>
  249. <li><code>list_boolean</code></li>
  250. <li><code>taxonomy_term_reference</code> <em>[Note: if value is a number, the field will be linked to the term with that tid; if value is a string, the field will be linked to an existing or a new term with that name.]</em></li>
  251. <li><code>file</code></li>
  252. </ul></p>
  253. <h5 id="fields_custom"><a href="#contents">2. Autocreation of Fields</a></h5>
  254. <p>Custom fields are automatically created if they don't exist and then attached to the vocabulary. By default, a 'text' field is created when the field doesn't exist. If you want to create another type of field, you have to set it with <code>"|"</code> symbol in the vocabulary section of the form. The field is not created or modified if it exists.</p>
  255. <p>For exemple, you want to import these items (<a href="https://drupal.org/node/1027068#comment-4194716">origine of example</a>):</p>
  256. <div class="codeblock"><ul>
  257. <li><code>name 1, tax gtin name 1, description 1, /home/robertom/file1.pdf, status 1, related term 1, related term 2, related term 3</code></li>
  258. <li><code>name 2, tax gtin name 2, description 2, /home/robertom/file2.pdf, status 2, related term 1, related term 4</code></li>
  259. <li><code>name 3, tax gtin name 3, description 3, /home/robertom/file3.pdf, status 3</code></li>
  260. </ul></div>
  261. <p>Your custom format will be:</p>
  262. <div class="codeblock">
  263. <code>name, field_internal_name, description, field_file, field_status, related_term, related_term, related_term</code>
  264. </div>
  265. <p>Your custom fields will be:</p>
  266. <div class="codeblock">
  267. <code>field_file|file, related_term|taxonomy_term_reference</code>
  268. </div>
  269. <h4 id="translate"><a href="#contents">3. Term translation</a></h4>
  270. <p>Translation is available only if <a href="https://drupal.org/project/i18n">i18n</a> is installed and the submodule i18n Taxonomy is enabled. Furthermore, the i18n mode of the vocabulary should be "Translate" or "Localize".</p>
  271. <p><strong>Warning</strong>: If you have a tree structure, you should import it before fields or translations, and for each translation if you use a full Translate mode.</p>
  272. <p>Format: The term is in the first column followed by its translations. If the i18n mode is Localize, then description and translated descriptions can be added.</p>
  273. <p>For vocabulary with Translate mode:</p>
  274. <div class="codeblock">
  275. <code>term name/id, first translated term name, second translated term name...</code>
  276. </div>
  277. <p>For vocabulary with Localize mode:</p>
  278. <div class="codeblock">
  279. <code>term name/id, first translation of term name... , description, first translation of description...</code>
  280. </div>
  281. <p>Examples:</p>
  282. <div class="codeblock"><ul>
  283. <li><code>foo, bar</code></li>
  284. <li><code>"United Kingdom", "Royaume-Uni", "Vereinigte Königreich"</code></li>
  285. <li><code>"Germany", "Allemagne", "A European country", "Un pays européen"</code> <em>[vocabulary with Localize mode only]</em></li>
  286. </ul></div>
  287. <p><strong>Notes</strong></p>
  288. <ul>
  289. <li>With a vocabulary in Translate mode, a term with an undefined language cannot be translated, so do not forget to choose a language when you import original terms.</li>
  290. <li>With a vocabulary in Localize mode, only terms with a undefined language can be translated, so do not set a language when you import original terms.</li>
  291. <li>All languages should have been enabled in Regional and language settings before import.</li>
  292. <li><strong>Important</strong>: If your taxonomy is structured, you should import the structure <em>before</em>. Furthermore, if the i18n mode is Translate, you should import the structure for each translation before. The translate process only creates translation sets for terms, but does not recreate any structure.</li>
  293. <li>With Translate mode, terms with an undefined language (<code>"und"</code>) cannot be translated.</li>
  294. <li>With Localize mode, only terms with an undefined language can be translated, so the first language should be "und" and the default language of the site cannot be used.</li>
  295. </ul>
  296. <h3 id="import"><a href="#contents">2. Import</a></h3>
  297. <p>Taxonomy CSV allows to import structure and properties of terms.</p>
  298. <h4 id="import_content"><a href="#contents">1. What to import (content of the source)?</a></h4>
  299. <p>Source can be configured with the first field set. See <a href='#formats'>formats</a>.</p>
  300. <h4 id="source"><a href="#contents">2. Where are terms to import?</a></h4>
  301. <p>You can import your terms from a file or with a text area. Simply check your choice. File can be a local file path or a url.</p>
  302. <h4 id="file_format"><a href="#contents">3. How is formatted your source?</a></h4>
  303. <p>Import need to be utf-8 formatted, without byte order mark in preference.</p>
  304. <p>This group of settings allows to set non standard delimiter and enclosure and specific locales, such as "fr_FR.utf8".</p>
  305. <ul>
  306. <li>
  307. Delimiters (comma "<strong><code>,</code></strong>" by default, semicolon "<strong><code>;</code></strong>" or tabulation) between terms can be chosen in Advanced settings in the second fieldset. You can choose a custom delimiter too. Delimiter is a one character string. Example with delimiter &lt; <strong><code>¤</code></strong> &gt;:<br />
  308. <div class="codeblock"><ul>
  309. <li><code>term 1¤This field has commas, a semicolon (;), a quotation mark (") and a tabulation, but it will be correctly imported.</code></li>
  310. </ul></div>
  311. </li>
  312. <li>
  313. It is recommended to protect terms with enclosure characters as quotation marks (<strong><code>"</code></strong>), specialy if they contain non-ASCII letters or if imported items, in particular descriptions, contain the chosen delimiter. Example:<br />
  314. <div class="codeblock"><ul>
  315. <li><code>"term 1","This field has a comma, but it will be correctly imported."</code></li>
  316. </ul></div>
  317. You can choose a custom enclosure character in Advanced settings in the second fieldset. Enclosure can have only one character or be null. Quotation marks (<strong><code>"</code></strong>) are automatically managed.
  318. </li>
  319. <li>
  320. Warning: when you export a vocabulary, delimiter and enclosure should not be used in term definitions, specially in descriptions. Export process will stop in case of problem.
  321. </li>
  322. </ul>
  323. <h4 id="destination"><a href="#contents">4. Which vocabulary do you want to import into?</a></h4>
  324. <p>You can import your terms in a existing vocabulary or create a new one. You can import your terms too in an existing vocabulary.</p>
  325. <p>When you want to import a new taxonomy into an existing one, it is recommended to process in two steps in order to check import.</p>
  326. <ul>
  327. <li>First, check the import file with the &lt; <em>Autocreate a new vocabulary</em> &gt; option. Repeat this step while there are warnings and notices.</li>
  328. <li>Second, you can import your file in the true vocabulary with the &lt; <em>Import in an existing vocabulary</em> &gt; option. This allows you to keep old links between existing terms and nodes.</li>
  329. </ul>
  330. <p>If you only want to create a new vocabulary, the first choice is sufficient, unless when you have multiple files for one vocabulary.</p>
  331. <h4 id="import_options"><a href="#contents">5. When a term exists, what to do with it?</a></h4>
  332. <p>Destination can be configured with the next field set. You can specify what will become existing terms when you import a term with the same name.</p>
  333. <ul>
  334. <li>
  335. <h5>Update terms and merge existing (avoid duplicate terms)</h5>
  336. <p>
  337. Update current terms when name matches with imported ones and merge existing descriptions, parents, etc. Duplicates are removed. This choice is recommended.
  338. Note: Duplicate terms in trees are fully supported.
  339. </p>
  340. </li>
  341. <li>
  342. <h5>Ignore current terms and create new ones (may create duplicate terms)</h5>
  343. <p>
  344. Let current terms as they are and create a new term for the first column term.
  345. <br />
  346. Warning: This can create duplicate terms. It is recommended to use this option only if you are sure that imported taxonomy contains only new terms or if your vocabulary allows multiple parents.
  347. </p>
  348. </li>
  349. </ul>
  350. <h4 id="info_process"><a href="#contents">6. Informations on process and big taxonomies import</a></h4>
  351. <p>This group of options allows to choose informations displayed at end of process.</p>
  352. <p>To import big taxonomies (from 1000 or 10000 lines depending on the server) when access to time and memory settings of server are forbidden, it is recommended first to disable some other taxonomy related modules as "pathauto" before import. Settings aren't lost when you disable a module - and not uninstall it -. After import process, modules can be reactivated.<br />
  353. Next, you can use these tweaks (in groups of options).</p>
  354. <ul>
  355. <li>
  356. <h5>Reduce log level</h5>
  357. <p>Stats, terms and notices or warnings displayed at the end of process are memory consomming. So, you can reduce or disable them.</p>
  358. </li>
  359. <li>
  360. <h5>Manually set vocabulary hierarchy</h5>
  361. <p>As to calculate vocabulary hierarchy is memory intensive, this option allows to set hierarchy manually without verify it.</p>
  362. </li>
  363. <li>
  364. <h5>Disable line checks</h5>
  365. <p>If you are sure that vocabulary to import is well formatted (utf8, order of items...), you can disable checks. This option increases import speed by 5%.</p>
  366. </li>
  367. </ul>
  368. <h3 id="export"><a href="#contents">3. Export</a></h3>
  369. <p>Taxonomy CSV allows to export structures and properties of terms of one or all vocabularies.</p>
  370. <p>Simply choose what you want to export (see <a href='#formats'>formats</a>) and how to export. Some formats may be unavailable.</p>
  371. <h3 id="import_api"><a href="#contents">4. Drush and Taxonomy csv import API</a></h3>
  372. <p>This module supports <a href="https://drupal.org/project/drush">drush</a>: you can import/export taxonomies from the command line interface with <code>drush taxocsv-import</code> and <code>drush taxocsv-export</code>. See command line help for more information.</p>
  373. <p>More generally, this module can be used as an API. You can use the full module as a dependance or directly in your module. Import is run as this:</p>
  374. <div class="codeblock"><code>
  375. $csv_lines = '"Europe", "France", "Paris"';<br />
  376. $csv_lines .= "\n". ',, "Lyon"';<br />
  377. $csv_lines .= "\n". ',"United Kingdom", "London"';<br />
  378. $csv_lines .= "\n". ',"Portugal", "Lisbonne"';<br />
  379. $result = taxonomy_csv_import(<br />
  380. array(<br />
  381. 'text' => $csv_lines,<br />
  382. 'import_format' => 'tree',<br />
  383. 'update_or_ignore' => 'update',<br />
  384. ));<br />
  385. </code></div>
  386. <p>Or as this (line level import):</p>
  387. <div class="codeblock"><code>
  388. $result = taxonomy_csv_line_import(<br />
  389. array("Europe", "France", "Paris"),<br />
  390. array(<br />
  391. 'import_format' => 'tree',<br /ta>
  392. 'vocabulary_id' => 2,<br />
  393. 'update_or_ignore' => 'update',<br />
  394. ));<br />
  395. </code></div>
  396. <p>Possible formats are explained in comments or <a href='#formats'>above</a>. Some may be unavailable.</p>
  397. <p><a href="https://drupal.org/project/taxonomy_builder" title="Taxonomy Builder API">Taxonomy Builder API</a> can be more convenient in some cases. Choice depends on your needs. Taxonomy CSV is designed as a run-once module with checks and multiple formats, while Taxonomy Builder is a permanent, light and quick module. A full explanation of the differences in design can be found here.</p>
  398. <h3 id="advanced_options"><a href="#contents">5. Advanced settings and hints</a></h3>
  399. <h4 id="permissions"><a href="#contents">1. Permissions</a></h4>
  400. <p>To import/export terms, user needs 'Import taxonomy by CSV' and 'Export taxonomy by CSV' rights.<br />
  401. Furthermore, user needs general <a href="?q=admin/user/permissions#module-taxonomy" title="configure taxonomy permissions">taxonomy permissions (Drupal 6)</a> or <a href="?q=admin/people/permissions#module-taxonomy" title="configure taxonomy permissions">taxonomy permissions (Drupal 7)</a>. These permissions are often associated with access rights for administration pages.</p>
  402. <h4 id="other_hints"><a href="#contents">2. Other hints</a></h4>
  403. <ul>
  404. <li>
  405. It's recommended to use utf8 encoded file in order to avoid problems with non-ASCII terms.
  406. </li>
  407. <li>
  408. Some memory or compatibility issues have been reported with some modules as <em>Pathauto</em>, <em>taxonomy_vtn</em> and <em>taxonomynode</em> (see <a href="https://drupal.org/node/495548">#495548</a>, <a href="https://drupal.org/node/447852">#447852</a> and <a href="https://drupal.org/node/540916">#540916</a>). It's advised to increase server and php memory temporary (no problem reported with 256 MB) or to disable these modules manually (settings aren't lost when you disable a module - and not uninstall it -). After import process, you can decrease memory and reactivate modules.
  409. </li>
  410. </ul>
  411. <p>Another Drupal module allows CSV import too, despite its name: <a href="https://drupal.org/project/taxonomy_xml" title="Taxonomy XML module">taxonomy XML</a>. Its approach is different: it uses one file compliant to thesauri standard ISO 2788, i.e. a three columns csv file: <code>term, type of link (relation, description, synonym...), item</code>, or, for specialists, <code>subject, predicate, object</code>. Additional fields are managed as the third one.</p>
  412. <p><a href="https://drupal.org/project/taxonomy_manager" title="Taxonomy manager">Taxonomy manager</a> can be used too.</p>
  413. <p>For export, you can use Taxonomy XML too or one of backup modules. Taxonomy CSV is a more specialised tool which allows more precise tuning.</p>
  414. <br />
  415. </body>
  416. </html>