I am trying to write data into an excel file. I execute the code, but when I then try to open the excel file, I am getting an error that states that the format or the extension are not valid. This is my first time working with excel files on PHP.
Here is my code:
$e = fopen("Test.xlsx", "w");
fwrite($e, $balances['XVG']['onOrder']);
fclose($e);
Does anyone knows what could be wrong? Thank you.
You can use PHPExcel:
How can i write data into an excel using PHP
You can also use Microsoft's XML format for Excel:
https://en.wikipedia.org/wiki/Microsoft_Office_XML_formats
To create a one row spreadsheet with a header, you would write the following XML to a file: