<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.dolibarr.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kario</id>
	<title>Dolibarr ERP CRM Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.dolibarr.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kario"/>
	<link rel="alternate" type="text/html" href="https://wiki.dolibarr.org/index.php/Special:Contributions/Kario"/>
	<updated>2026-11-10T21:13:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://wiki.dolibarr.org/index.php?title=Importing_customers_automatically&amp;diff=18110</id>
		<title>Importing customers automatically</title>
		<link rel="alternate" type="text/html" href="https://wiki.dolibarr.org/index.php?title=Importing_customers_automatically&amp;diff=18110"/>
		<updated>2010-02-01T23:42:57Z</updated>

		<summary type="html">&lt;p&gt;Kario: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ImportsEn]]&lt;br /&gt;
{{ToTranslate}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This page describes an example of development used to make imports in Dolibarr by coding. If you are looking for other methods, see [[Mass_imports]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[edit] Data file&lt;br /&gt;
&lt;br /&gt;
First you must create your data file and make sure it meets a specific structure:&lt;br /&gt;
&lt;br /&gt;
This file should contain the following fields and must be separated by tabs. The easiest way is to work with excel and then save your document as a tab-delimited text file.&lt;br /&gt;
&lt;br /&gt;
Column1: code_client&lt;br /&gt;
&lt;br /&gt;
Column2: company name&lt;br /&gt;
&lt;br /&gt;
Column3: supplement company name&lt;br /&gt;
&lt;br /&gt;
Column 4: Address Line 1&lt;br /&gt;
&lt;br /&gt;
Column 5: Address Line 2&lt;br /&gt;
&lt;br /&gt;
Colonne6: Address Line 3&lt;br /&gt;
&lt;br /&gt;
Colonne7: Zip Code&lt;br /&gt;
&lt;br /&gt;
Colonne8: City &lt;br /&gt;
&lt;br /&gt;
As you can see the address must be standardized (2 lines for name and 3 lines for the address + ZIP + City). During the import process the 3 address lines will be entered in the single &amp;quot;address&amp;quot; field of Dolibarr with a carriage return after each line. The same will applied for the company name and the company supplement name that will populate the single field &amp;quot;name&amp;quot; of Dolibarr with automatic carriage return.&lt;br /&gt;
&lt;br /&gt;
Colonne9: telephone&lt;br /&gt;
&lt;br /&gt;
Colonne10: fax&lt;br /&gt;
&lt;br /&gt;
Colonne11: email&lt;br /&gt;
&lt;br /&gt;
Colonne12: customer (1 per customer, prospect 2, 0 otherwise)&lt;br /&gt;
&lt;br /&gt;
Colonne13: Provider (1 for supplier or 0 if not vendor)&lt;br /&gt;
&lt;br /&gt;
Colonne14: legal form (See table values llx_c_forme_juridique to feed that column. You can leave this column blank)&lt;br /&gt;
&lt;br /&gt;
Colonne15: type of business (See table values llx_c_typent to feed that column. You can leave this column blank)&lt;br /&gt;
&lt;br /&gt;
Colonne16: Country code (See table values llx_c_pays to feed that column. You can leave this column blank)&lt;br /&gt;
&lt;br /&gt;
Colonne17: url (url of the websites of companies. You can leave this column blank)&lt;br /&gt;
&lt;br /&gt;
Do not add column&#039;s header in your file.&lt;br /&gt;
&lt;br /&gt;
Once your columns are filled in, save your file in your data directory under the name societe.txt&lt;br /&gt;
&lt;br /&gt;
= Import script file =&lt;br /&gt;
&lt;br /&gt;
Copy/paste the content below in a new file and save as &amp;quot;import_client.php&amp;quot; under the directory /scripts&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!doctype html public &amp;quot;-//W3C//DTD HTML 4.0 //EN&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       &amp;lt;title&amp;gt;Title here!&amp;lt;/title&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;$sql_host= &amp;quot;localhost&amp;quot;;&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;$sql_login= &amp;quot;root&amp;quot;;&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;$sql_pass= &amp;quot;&amp;quot;;&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;$sql_base= &amp;quot;nomdevotrebasededonnées&amp;quot;;&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$dbid = mysql_connect(&amp;quot;$sql_host&amp;quot;, &amp;quot;$sql_login&amp;quot;, &amp;quot;$sql_pass&amp;quot;);&lt;br /&gt;
mysql_select_db(&amp;quot;$sql_base&amp;quot;,$dbid);&lt;br /&gt;
&lt;br /&gt;
if(file_exists(&amp;quot;&#039;&#039;&#039;&#039;&#039;../../../mysql/data/demopasspro/societe.txt&#039;&#039;&#039;&#039;&#039;&amp;quot;)) {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	create table if not exists societe_tmp &lt;br /&gt;
	(&lt;br /&gt;
	 code_client        varchar(15),&lt;br /&gt;
	 nom                varchar(60),&lt;br /&gt;
	 complement         varchar(60),&lt;br /&gt;
	 address1            varchar(255),&lt;br /&gt;
	 address2            varchar(255),&lt;br /&gt;
	 address3            varchar(255),&lt;br /&gt;
	 cp                 varchar(10),&lt;br /&gt;
	 ville              varchar(50),&lt;br /&gt;
	 tel                varchar(20),&lt;br /&gt;
	 fax                varchar(20),&lt;br /&gt;
	 email              varchar(128),&lt;br /&gt;
	 client             tinyint        DEFAULT 0,&lt;br /&gt;
	 fournisseur        tinyint        DEFAULT 0,&lt;br /&gt;
	 fk_forme_juridique integer        DEFAULT 0,&lt;br /&gt;
	 fk_typent          integer        DEFAULT 0,&lt;br /&gt;
	 fk_pays          integer        DEFAULT 0,&lt;br /&gt;
	 url          varchar(255)&lt;br /&gt;
&lt;br /&gt;
	);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	$query_content=&amp;quot;delete from societe_tmp&amp;quot;;&lt;br /&gt;
	$result_content=mysql_query($query_content,$dbid);&lt;br /&gt;
&lt;br /&gt;
	$query_content=&amp;quot;LOAD DATA INFILE &#039;societe.txt&#039; into table societe_tmp fields terminated by &#039;\t&#039; ENCLOSED BY &#039;\&amp;quot;&#039; lines terminated by &#039;\r\n&#039;&amp;quot;  ;&lt;br /&gt;
&lt;br /&gt;
	$result_content=mysql_query($query_content,$dbid);&lt;br /&gt;
&lt;br /&gt;
	$requete=mysql_query(&amp;quot;select * from societe_tmp &amp;quot;) or die(&amp;quot;Erreur SQL : $query&amp;lt;br/&amp;gt;&amp;quot;.mysql_error());&lt;br /&gt;
&lt;br /&gt;
	$i=0;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	while ($data=mysql_fetch_array($requete))&lt;br /&gt;
	{&lt;br /&gt;
	$i=$i+1;&lt;br /&gt;
&lt;br /&gt;
	$sql = &amp;quot;INSERT INTO llx_societe (datec, client, nom, address,cp,ville,tel,fax,email,fournisseur,fk_forme_juridique,fk_typent,code_client,fk_pays,url,fk_user_creat) &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
	$valeur_concat=&#039;&amp;quot;&#039;.date(&amp;quot;Y-m-d H:m:s&amp;quot;).&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;client&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;nom&#039;].&amp;quot; &amp;quot;.$data[&#039;complement&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;address1&#039;].&amp;quot;\\r\n&amp;quot;.$data[&#039;address2&#039;].&amp;quot;\\r\n&amp;quot;.$data[&#039;address3&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;cp&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;ville&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;tel&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;fax&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;email&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;fournisseur&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;fk_forme_juridique&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;fk_typent&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;code_client&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;fk_pays&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;url&#039;].&#039;&amp;quot;,&amp;quot;1&amp;quot;&#039;;&lt;br /&gt;
&lt;br /&gt;
	$sql .= &amp;quot;VALUES ($valeur_concat);&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	$result_content=mysql_query($sql);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	echo &amp;quot;Nb de clients importés:&amp;quot;.$i;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Edit the content of this file (the data to modify are in bold italics:&lt;br /&gt;
&lt;br /&gt;
access to the database&lt;br /&gt;
&lt;br /&gt;
path to data according to your tree&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All you have to do is open this file with your browser and your data file will be imported.&lt;br /&gt;
&lt;br /&gt;
Hoping it will help some people.&lt;/div&gt;</summary>
		<author><name>Kario</name></author>
	</entry>
	<entry>
		<id>https://wiki.dolibarr.org/index.php?title=Importing_customers_automatically&amp;diff=18109</id>
		<title>Importing customers automatically</title>
		<link rel="alternate" type="text/html" href="https://wiki.dolibarr.org/index.php?title=Importing_customers_automatically&amp;diff=18109"/>
		<updated>2010-02-01T23:40:57Z</updated>

		<summary type="html">&lt;p&gt;Kario: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ImportsEn]]&lt;br /&gt;
{{ToTranslate}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This page describes an example of development used to make imports in Dolibarr by coding. If you are looking for other methods, see [Mass imports].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[edit] Data file&lt;br /&gt;
&lt;br /&gt;
First you must create your data file and make sure it meets a specific structure:&lt;br /&gt;
&lt;br /&gt;
This file should contain the following fields and must be separated by tabs. The easiest way is to work with excel and then save your document as a tab-delimited text file.&lt;br /&gt;
&lt;br /&gt;
Column1: code_client&lt;br /&gt;
&lt;br /&gt;
Column2: company name&lt;br /&gt;
&lt;br /&gt;
Column3: supplement company name&lt;br /&gt;
&lt;br /&gt;
Column 4: Address Line 1&lt;br /&gt;
&lt;br /&gt;
Column 5: Address Line 2&lt;br /&gt;
&lt;br /&gt;
Colonne6: Address Line 3&lt;br /&gt;
&lt;br /&gt;
Colonne7: Zip Code&lt;br /&gt;
&lt;br /&gt;
Colonne8: City &lt;br /&gt;
&lt;br /&gt;
As you can see the address must be standardized (2 lines for name and 3 lines for the address + ZIP + City). During the import process the 3 address lines will be entered in the single &amp;quot;address&amp;quot; field of Dolibarr with a carriage return after each line. The same will applied for the company name and the company supplement name that will populate the single field &amp;quot;name&amp;quot; of Dolibarr with automatic carriage return.&lt;br /&gt;
&lt;br /&gt;
Colonne9: telephone&lt;br /&gt;
&lt;br /&gt;
Colonne10: fax&lt;br /&gt;
&lt;br /&gt;
Colonne11: email&lt;br /&gt;
&lt;br /&gt;
Colonne12: customer (1 per customer, prospect 2, 0 otherwise)&lt;br /&gt;
&lt;br /&gt;
Colonne13: Provider (1 for supplier or 0 if not vendor)&lt;br /&gt;
&lt;br /&gt;
Colonne14: legal form (See table values llx_c_forme_juridique to feed that column. You can leave this column blank)&lt;br /&gt;
&lt;br /&gt;
Colonne15: type of business (See table values llx_c_typent to feed that column. You can leave this column blank)&lt;br /&gt;
&lt;br /&gt;
Colonne16: Country code (See table values llx_c_pays to feed that column. You can leave this column blank)&lt;br /&gt;
&lt;br /&gt;
Colonne17: url (url of the websites of companies. You can leave this column blank)&lt;br /&gt;
&lt;br /&gt;
Do not add column&#039;s header in your file.&lt;br /&gt;
&lt;br /&gt;
Once your columns are filled in, save your file in your data directory under the name societe.txt&lt;br /&gt;
&lt;br /&gt;
= Import script file =&lt;br /&gt;
&lt;br /&gt;
Copy/paste the content below in a new file and save as &amp;quot;import_client.php&amp;quot; under the directory /scripts&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!doctype html public &amp;quot;-//W3C//DTD HTML 4.0 //EN&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       &amp;lt;title&amp;gt;Title here!&amp;lt;/title&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;$sql_host= &amp;quot;localhost&amp;quot;;&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;$sql_login= &amp;quot;root&amp;quot;;&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;$sql_pass= &amp;quot;&amp;quot;;&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;$sql_base= &amp;quot;nomdevotrebasededonnées&amp;quot;;&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$dbid = mysql_connect(&amp;quot;$sql_host&amp;quot;, &amp;quot;$sql_login&amp;quot;, &amp;quot;$sql_pass&amp;quot;);&lt;br /&gt;
mysql_select_db(&amp;quot;$sql_base&amp;quot;,$dbid);&lt;br /&gt;
&lt;br /&gt;
if(file_exists(&amp;quot;&#039;&#039;&#039;&#039;&#039;../../../mysql/data/demopasspro/societe.txt&#039;&#039;&#039;&#039;&#039;&amp;quot;)) {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	create table if not exists societe_tmp &lt;br /&gt;
	(&lt;br /&gt;
	 code_client        varchar(15),&lt;br /&gt;
	 nom                varchar(60),&lt;br /&gt;
	 complement         varchar(60),&lt;br /&gt;
	 address1            varchar(255),&lt;br /&gt;
	 address2            varchar(255),&lt;br /&gt;
	 address3            varchar(255),&lt;br /&gt;
	 cp                 varchar(10),&lt;br /&gt;
	 ville              varchar(50),&lt;br /&gt;
	 tel                varchar(20),&lt;br /&gt;
	 fax                varchar(20),&lt;br /&gt;
	 email              varchar(128),&lt;br /&gt;
	 client             tinyint        DEFAULT 0,&lt;br /&gt;
	 fournisseur        tinyint        DEFAULT 0,&lt;br /&gt;
	 fk_forme_juridique integer        DEFAULT 0,&lt;br /&gt;
	 fk_typent          integer        DEFAULT 0,&lt;br /&gt;
	 fk_pays          integer        DEFAULT 0,&lt;br /&gt;
	 url          varchar(255)&lt;br /&gt;
&lt;br /&gt;
	);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	$query_content=&amp;quot;delete from societe_tmp&amp;quot;;&lt;br /&gt;
	$result_content=mysql_query($query_content,$dbid);&lt;br /&gt;
&lt;br /&gt;
	$query_content=&amp;quot;LOAD DATA INFILE &#039;societe.txt&#039; into table societe_tmp fields terminated by &#039;\t&#039; ENCLOSED BY &#039;\&amp;quot;&#039; lines terminated by &#039;\r\n&#039;&amp;quot;  ;&lt;br /&gt;
&lt;br /&gt;
	$result_content=mysql_query($query_content,$dbid);&lt;br /&gt;
&lt;br /&gt;
	$requete=mysql_query(&amp;quot;select * from societe_tmp &amp;quot;) or die(&amp;quot;Erreur SQL : $query&amp;lt;br/&amp;gt;&amp;quot;.mysql_error());&lt;br /&gt;
&lt;br /&gt;
	$i=0;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	while ($data=mysql_fetch_array($requete))&lt;br /&gt;
	{&lt;br /&gt;
	$i=$i+1;&lt;br /&gt;
&lt;br /&gt;
	$sql = &amp;quot;INSERT INTO llx_societe (datec, client, nom, address,cp,ville,tel,fax,email,fournisseur,fk_forme_juridique,fk_typent,code_client,fk_pays,url,fk_user_creat) &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
	$valeur_concat=&#039;&amp;quot;&#039;.date(&amp;quot;Y-m-d H:m:s&amp;quot;).&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;client&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;nom&#039;].&amp;quot; &amp;quot;.$data[&#039;complement&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;address1&#039;].&amp;quot;\\r\n&amp;quot;.$data[&#039;address2&#039;].&amp;quot;\\r\n&amp;quot;.$data[&#039;address3&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;cp&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;ville&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;tel&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;fax&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;email&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;fournisseur&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;fk_forme_juridique&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;fk_typent&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;code_client&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;fk_pays&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;url&#039;].&#039;&amp;quot;,&amp;quot;1&amp;quot;&#039;;&lt;br /&gt;
&lt;br /&gt;
	$sql .= &amp;quot;VALUES ($valeur_concat);&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	$result_content=mysql_query($sql);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	echo &amp;quot;Nb de clients importés:&amp;quot;.$i;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Edit the content of this file (the data to modify are in bold italics:&lt;br /&gt;
&lt;br /&gt;
access to the database&lt;br /&gt;
&lt;br /&gt;
path to data according to your tree&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All you have to do is open this file with your browser and your data file will be imported.&lt;br /&gt;
&lt;br /&gt;
Hoping it will help some people.&lt;/div&gt;</summary>
		<author><name>Kario</name></author>
	</entry>
	<entry>
		<id>https://wiki.dolibarr.org/index.php?title=Importing_customers_automatically&amp;diff=18108</id>
		<title>Importing customers automatically</title>
		<link rel="alternate" type="text/html" href="https://wiki.dolibarr.org/index.php?title=Importing_customers_automatically&amp;diff=18108"/>
		<updated>2010-02-01T23:33:24Z</updated>

		<summary type="html">&lt;p&gt;Kario: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ImportsEn]]&lt;br /&gt;
{{ToTranslate}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This page describes an example of development used to make imports in Dolibarr by coding. If you are looking for other methods, see Mass imports.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[edit] Data file&lt;br /&gt;
&lt;br /&gt;
First you must create your data file and make sure it meets a specific structure:&lt;br /&gt;
&lt;br /&gt;
This file should contain the following fields and must be separated by tabs. The easiest way is to work with excel and then save your document as a tab-delimited text file.&lt;br /&gt;
&lt;br /&gt;
Column1: code_client&lt;br /&gt;
&lt;br /&gt;
Column2: company name&lt;br /&gt;
&lt;br /&gt;
Column3: supplement company name&lt;br /&gt;
&lt;br /&gt;
Column 4: Address Line 1&lt;br /&gt;
&lt;br /&gt;
Column 5: Address Line 2&lt;br /&gt;
&lt;br /&gt;
Colonne6: Address Line 3&lt;br /&gt;
&lt;br /&gt;
Colonne7: Zip Code&lt;br /&gt;
&lt;br /&gt;
Colonne8: City &lt;br /&gt;
&lt;br /&gt;
As you can see the address must be standardized (2 lines for name and 3 lines for the address + ZIP + City). During the import process the 3 address lines will be entered in the single &amp;quot;address&amp;quot; field of Dolibarr with a carriage return after each line. The same will applied for the company name and the company supplement name that will populate the single field &amp;quot;name&amp;quot; of Dolibarr with automatic carriage return.&lt;br /&gt;
&lt;br /&gt;
Colonne9: telephone&lt;br /&gt;
&lt;br /&gt;
Colonne10: fax&lt;br /&gt;
&lt;br /&gt;
Colonne11: email&lt;br /&gt;
&lt;br /&gt;
Colonne12: customer (1 per customer, prospect 2, 0 otherwise)&lt;br /&gt;
&lt;br /&gt;
Colonne13: Provider (1 for supplier or 0 if not vendor)&lt;br /&gt;
&lt;br /&gt;
Colonne14: legal form (See table values llx_c_forme_juridique to feed that column. You can leave this column blank)&lt;br /&gt;
&lt;br /&gt;
Colonne15: type of business (See table values llx_c_typent to feed that column. You can leave this column blank)&lt;br /&gt;
&lt;br /&gt;
Colonne16: Country code (See table values llx_c_pays to feed that column. You can leave this column blank)&lt;br /&gt;
&lt;br /&gt;
Colonne17: url (url of the websites of companies. You can leave this column blank)&lt;br /&gt;
&lt;br /&gt;
Do not add column&#039;s header in your file.&lt;br /&gt;
&lt;br /&gt;
Once your columns are filled in, save your file in your data directory under the name societe.txt&lt;br /&gt;
&lt;br /&gt;
= Import script file =&lt;br /&gt;
&lt;br /&gt;
Copy/paste the content below in a new file and save as &amp;quot;import_client.php&amp;quot; under the directory /scripts&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!doctype html public &amp;quot;-//W3C//DTD HTML 4.0 //EN&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       &amp;lt;title&amp;gt;Title here!&amp;lt;/title&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;$sql_host= &amp;quot;localhost&amp;quot;;&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;$sql_login= &amp;quot;root&amp;quot;;&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;$sql_pass= &amp;quot;&amp;quot;;&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;$sql_base= &amp;quot;nomdevotrebasededonnées&amp;quot;;&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$dbid = mysql_connect(&amp;quot;$sql_host&amp;quot;, &amp;quot;$sql_login&amp;quot;, &amp;quot;$sql_pass&amp;quot;);&lt;br /&gt;
mysql_select_db(&amp;quot;$sql_base&amp;quot;,$dbid);&lt;br /&gt;
&lt;br /&gt;
if(file_exists(&amp;quot;&#039;&#039;&#039;&#039;&#039;../../../mysql/data/demopasspro/societe.txt&#039;&#039;&#039;&#039;&#039;&amp;quot;)) {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	create table if not exists societe_tmp &lt;br /&gt;
	(&lt;br /&gt;
	 code_client        varchar(15),&lt;br /&gt;
	 nom                varchar(60),&lt;br /&gt;
	 complement         varchar(60),&lt;br /&gt;
	 address1            varchar(255),&lt;br /&gt;
	 address2            varchar(255),&lt;br /&gt;
	 address3            varchar(255),&lt;br /&gt;
	 cp                 varchar(10),&lt;br /&gt;
	 ville              varchar(50),&lt;br /&gt;
	 tel                varchar(20),&lt;br /&gt;
	 fax                varchar(20),&lt;br /&gt;
	 email              varchar(128),&lt;br /&gt;
	 client             tinyint        DEFAULT 0,&lt;br /&gt;
	 fournisseur        tinyint        DEFAULT 0,&lt;br /&gt;
	 fk_forme_juridique integer        DEFAULT 0,&lt;br /&gt;
	 fk_typent          integer        DEFAULT 0,&lt;br /&gt;
	 fk_pays          integer        DEFAULT 0,&lt;br /&gt;
	 url          varchar(255)&lt;br /&gt;
&lt;br /&gt;
	);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	$query_content=&amp;quot;delete from societe_tmp&amp;quot;;&lt;br /&gt;
	$result_content=mysql_query($query_content,$dbid);&lt;br /&gt;
&lt;br /&gt;
	$query_content=&amp;quot;LOAD DATA INFILE &#039;societe.txt&#039; into table societe_tmp fields terminated by &#039;\t&#039; ENCLOSED BY &#039;\&amp;quot;&#039; lines terminated by &#039;\r\n&#039;&amp;quot;  ;&lt;br /&gt;
&lt;br /&gt;
	$result_content=mysql_query($query_content,$dbid);&lt;br /&gt;
&lt;br /&gt;
	$requete=mysql_query(&amp;quot;select * from societe_tmp &amp;quot;) or die(&amp;quot;Erreur SQL : $query&amp;lt;br/&amp;gt;&amp;quot;.mysql_error());&lt;br /&gt;
&lt;br /&gt;
	$i=0;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	while ($data=mysql_fetch_array($requete))&lt;br /&gt;
	{&lt;br /&gt;
	$i=$i+1;&lt;br /&gt;
&lt;br /&gt;
	$sql = &amp;quot;INSERT INTO llx_societe (datec, client, nom, address,cp,ville,tel,fax,email,fournisseur,fk_forme_juridique,fk_typent,code_client,fk_pays,url,fk_user_creat) &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
	$valeur_concat=&#039;&amp;quot;&#039;.date(&amp;quot;Y-m-d H:m:s&amp;quot;).&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;client&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;nom&#039;].&amp;quot; &amp;quot;.$data[&#039;complement&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;address1&#039;].&amp;quot;\\r\n&amp;quot;.$data[&#039;address2&#039;].&amp;quot;\\r\n&amp;quot;.$data[&#039;address3&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;cp&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;ville&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;tel&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;fax&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;email&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;fournisseur&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;fk_forme_juridique&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;fk_typent&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;code_client&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;fk_pays&#039;].&#039;&amp;quot;,&amp;quot;&#039;.$data[&#039;url&#039;].&#039;&amp;quot;,&amp;quot;1&amp;quot;&#039;;&lt;br /&gt;
&lt;br /&gt;
	$sql .= &amp;quot;VALUES ($valeur_concat);&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	$result_content=mysql_query($sql);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	echo &amp;quot;Nb de clients importés:&amp;quot;.$i;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Edit the content of this file (the data to modify are in bold italics:&lt;br /&gt;
&lt;br /&gt;
access to the database&lt;br /&gt;
&lt;br /&gt;
path to data according to your tree&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All you have to do is open this file with your browser and your data file will be imported.&lt;br /&gt;
&lt;br /&gt;
Hoping it will help some people.&lt;/div&gt;</summary>
		<author><name>Kario</name></author>
	</entry>
</feed>