<?php 
//require __DIR__ . "/vendor/autoload.php";
require "vendor/autoload.php";
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;

$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$a="we";
$a1="are";
$a2="the";
$a3="world"; 

$sheet->setCellValue('A1', $a);
$sheet->setCellValue('B1', $a1);
$sheet->setCellValue('C1', $a2);
$sheet->setCellValue('D1', $a3);

$writer = new Xlsx($spreadsheet);
//$writer->save('C:\xampp\ejemplo.xlsx');
$writer->save('ejemplo2.xls');  

?>