In fetching data from file_get_contents function to add the data in array. The data then added to excel with XLSXWriter. It looks like the respond to foreach is limited to 100. Is this possible to change so it could be a larger amount?
$data = file_get_contents("/home/user/testfile.json");
$json_obj = json_decode($data, true);
foreach ($json_obj['items'] as $order) {
$ordrenr = $order['id'];
$fornavn= $order['billingPerson']['firstName'];
$etternavn= $order['billingPerson']['lastName'];
$adresse = $order['billingPerson']['street'];
$postnr = $order['billingPerson']['postalCode'];
$sted = $order['billingPerson']['city'];
$mobil = $order['billingPerson']['phone'];
$epost = $order['email'];
$subtotal = $order['total'];
$bestilt = $order['createDate'];
$betalingstype = $order['paymentMethod'];
$fakturanr = $order['invoices'][0]['id'];
$fakturalink = $order['invoices'][0] ['link'];
$header = ['Ordrenr' => 'string',
'Fornavn' => 'string',
'Etternavn' => 'string',
'Adresse' => 'string',
'Postnr' => 'string',
'Sted' => 'string',
'Mobil' => 'string',
'Epost' => 'string',
'Bestilt' => 'string',
'OrdreSum Inkl MVA' => 'string',
'Betalingtype' => 'string',
'Faktura nr' => 'string',
'Ordreskjema' => 'string' ];
$rows[] = [$ordrenr, $fornavn, $etternavn, $adresse , $postnr, $sted , $mobil, $epost, $bestilt, $subtotal, $betalingstype , $fakturanr, $fakturalink];
}
$structure = "/home/user/testfolder/";
if (!file_exists ($structure))
{
mkdir($structure, 0777, true);
}
$writer = new XLSXWriter();
$writer->setAuthor('Author');
$writer->writeSheet($rows, 'SHEETNAME', $header);
$writer->writeToFile("/home/user/testfolder/" . "April_". "$from". "_data.xlsx" );