Document Conversion Online

Import/Export CSV, Excel, PDF, Database , Array, HTML, SQL, XML

Insert/Append records to excel


Student No
Title
First Name
Last Name
Gender
Male Female
Home No
Address
Mobile No
Email
Institute
Grade
Excel Format
Code For Excel
<?php
/* include the ACS class page */
   require_once("../../classes/ACS.php");

/* Step 1: create object of the ACS class */
   $ACS=new ACS();
   
/* Step 2: set values of required parameters */   
//set append=true as we will add new row in excel everytime on insert operation
$ACS->append=true;

//set path of the existing excel file, on which we will save/append data
$ACS->existingFilePath="demo_excel_csv/STUDENTS.xls";

//set 2 dimensional associative array
$data=array(array("studentNo"=>$_POST["studentNo"], "title"=>$_POST["title"], "firstName"=>$_POST["firstName"], "lastName"=>$_POST["lastName"], "gender"=>$_POST["gender"], "address"=>$_POST["address"], "mobileNumber"=>$_POST["mobileNo"], "homeNumber"=>$_POST["homeNo"], 
"email"=>$_POST["email"], "institute"=>$_POST["institute"], "grade"=>$_POST["grade"]));

$ACS->arrayToExcel($data); //convert array to excel

?>