My picI’ve seen it happening to many sites and I always thought of this as impossible. I beleived that since the api is closed you cannot export into this format. It turns out that i was wrong. Well, as it turned out, not entirely… I mean the api is still closed but an XML can be parsed.

So all you have to do is write a file with the following format:



This is a perfect xls file that has two rows with two columns of data on the first and one on the second. Now, if you want to send this from a server to a browser use the following code:

header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=voters-export-".date('d-m-Y').".xls");
header("Content-Type: application/ms-excel");
header("Pragma: no-cache");
header("Expires: 0");

With this you are done!