multiple worksheets di php excel [SOLVED]

ada yg punya referensi phpexcel multiple worksheets? saya ngikutin tutor phpexcel sekolah koding tapi bingung karena ga ada multiple worksheets. ini kode nya


<?php
require_once dirname(__FILE__) . '/functions/Classes/PHPExcel.php';

$phpExcel = new PHPExcel();

$phpExcel->getProperties()->setCreator("Nandar Sukmana")
         ->setTitle('Contoh')
         ->setSubject('Ini hanya contoh')
         ->setDescription('Summary absen');

$phpExcel->getActiveSheet()->setTitle('pertama');
$phpExcel->setActiveSheetIndex(0)
         ->setCellValue('A1','contoh 1')
         ->setCellValue('A2','contoh 2');

$writer = PHPExcel_IOFactory::createWriter($phpExcel, 'Excel5');
$writer->save('excel/contoh1.xls');

 ?>


avatar Nandar
@Nandar

648 Kontribusi 204 Poin

Diperbarui 7 tahun yang lalu

1 Jawaban:

Jawaban Terpilih


$phpExcel = $PE->createSheet($wk);

        $phpExcel->setCellValue('A1','contoh 1')
                 ->setCellValue('B1','contoh 2');

        $col3 = 2;

        foreach ($largest3 as $ls3) {
           $phpExcel->setCellValueByColumnAndRow(0, $col3, $ls3);
                    $col3++;
        }

        $col4 = 2;

        foreach ($largest4 as $ls4) {
           $phpExcel->setCellValueByColumnAndRow(1, $col4, $ls4);
                    $col4++;
        }

        $wk++;

      }

    }

  }

          $writer = PHPExcel_IOFactory::createWriter($PE, 'Excel5');
          $writer->save('excel/contoh1.xls');

avatar Nandar
@Nandar

648 Kontribusi 204 Poin

Dipost 7 tahun yang lalu

Login untuk ikut Jawaban