Skip to content

Instantly share code, notes, and snippets.

@BrunoAssis
BrunoAssis / gist:5558544
Created May 11, 2013 01:28
Excel macro example in PHP.
<?php
// set up excel
$excel = new COM("excel.application") or die("Unable to instantiate excel");
// run Excel silently, since we don’t want dialog boxes popping up in the background
$excel->DisplayAlerts = false;
// open up Excel file and select the first sheet, which contains the inputs
$excel->Workbooks->Add();
$book = $excel->ActiveWorkbook;
$sheets = $book->Sheets;
$sheet = $book->Worksheets(1);