Here we are describing convert xml file into excel file using php.Simple way to convert xml file into excel file with php.If you have basic knowledge of xml and php(:D) this is very easy.My another post is showing how to read Excel file and save details to database using php. If you not good familiar with xml read this PHP Creating XML file post and Read XML file using PHP post to get and better idea.

Okay.First you need to create you xml file. I’ll show you my xml file format for a example.
Library.xml




	
		
		Miguel Alvarez
		WebHole
		10.00
	
	
	
		
		Vijay Joshi
		Reilly Media
		20.99
	
	
	
		
		WIlliam Vega
		WebHole
		15.25
	
	

How to read this xml file?

    $url = 'Library.xml'; // xml file location with file name
if (file_exists($url)) {
    $xml = simplexml_load_file($url);
    print_r($xml);
}

How to convert xml file into excel file?

book as $books)
	{
		echo $books->title."\t" . $books->author."\t" . $books->publisher."\t" . $books->price."\n";
	}
}
?>

That’s only.
Remember this is simple example to show how to convert xml file into excel file using php.
Here is the full source code to download.

[like-to-dl theme=”blue” url=”http://481f240e.linkbucks.com” like_url=”https://www.facebook.com/pages/WebExplorarcom/308199725882057?ref=hl” message=”Click Like to Start Download full source code(2 KiB)”]

About Sumith Harshan

Sumith Harshan is the Managing Director of the WebXtreams(Pvt) Ltd in Sri lanka.Specializes in Java Script, JQuery, HTML4/5, CSS2/3, PHP, CodeIgniter, CakePHP, J2SE, J2EE, XML, Hacking & Security, Mobile Interface Developing, Magento, WordPress, Joomla, Drupal and PHPBB.

Tags

Similar posts

  • Vignesh Waran

    you are awesome …thanks working great, and i need excel to xml using php.thanks