Skip to content Skip to sidebar Skip to footer

Convert xml file into excel file using php

Reading Time: < 1 minute

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



	
		PHP and MySQL
		Miguel Alvarez
		WebHole
		10.00
	
	
		PHP jQuery Cookbook
		Vijay Joshi
		Reilly Media
		20.99
	
	
		JAVA 123
		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)”]