logo
down
shadow

Add a comment in a sheet with PHPEXCEL


Add a comment in a sheet with PHPEXCEL

By : Eric Allen Griff
Date : November 19 2020, 01:01 AM
I wish did fix the issue. I'm trying with this code to add a comment in a Excel cell : , OK, I found a solution :
I created an array :
code :
$arr_lettres = array(2=>'C',3=>'D',4=>'E',5=>'F',6=>'G',7=>'H',8=>'I',9=>'J',10=>'K',11=>'L',12=>'M',13=>'N',14=>'O',15=>'P',16=>'Q',17=>'R',18=>'S',19=>'T',20=>'U',21=>'V',22=>'W',23=>'X',24=>'Y',25=>'Z',26=>'AA',27=>'AB',28=>'AC',29=>'AD',30=>'AE',31=>'AF',32=>'AG');
$objPHPExcel->getActiveSheet()
                        ->getComment($arr_lettres[($arr_periodes[2]+1)].(17+$arr_periodes[1]))
                        ->getText()->createTextRun($periodes->commentaire);


Share : facebook icon twitter icon
PHPExcel : Splitting an Excel document sheet by sheet

PHPExcel : Splitting an Excel document sheet by sheet


By : user3596101
Date : March 29 2020, 07:55 AM
may help you . I have found the way of what I wanted.
Here is a solution (maybe not the best way, but it works fine enough) :
code :
$file = $_POST['file'];
$filename = pathinfo($file, PATHINFO_FILENAME);

require_once 'phpexcel/Classes/PHPExcel.php';

$xls = new PHPExcel();
$xlsReader= new PHPExcel_Reader_Excel5();
$xlsTemplate = $xlsReader->load($file);

$sheet1 = $xlsTemplate->getSheetByName('Sheet1');
$xls->addExternalSheet($sheet1,0);
$xls->removeSheetByIndex(1);
$xlsWriter = new PHPExcel_Writer_Excel5($xls);
$xlsWriter->save($filename."_Sheet1.xls");

$sheet2 = $xlsTemplate->getSheetByName('Sheet2');
$xls->addExternalSheet($sheet2,0);
$xls->removeSheetByIndex(1);
$xlsWriter = new PHPExcel_Writer_Excel5($xls);
$xlsWriter->save($filename."_Sheet2.xls");

$sheet3 = $xlsTemplate->getSheetByName('Sheet3');
$xls->addExternalSheet($sheet3,0);
$xls->removeSheetByIndex(1);
$xlsWriter = new PHPExcel_Writer_Excel5($xls);
$xlsWriter->save($filename."_Sheet3.xls");

$sheet4 = $xlsTemplate->getSheetByName('Sheet4');
$xls->addExternalSheet($sheet4,0);
$xls->removeSheetByIndex(1);
$xlsWriter = new PHPExcel_Writer_Excel5($xls);
$xlsWriter->save($filename."_Sheet4.xls");

$sheet5 = $xlsTemplate->getSheetByName('Sheet5');
$xls->addExternalSheet($sheet5,0);
$xls->removeSheetByIndex(1);
$xlsWriter = new PHPExcel_Writer_Excel5($xls);
$xlsWriter->save($filename."_Sheet5.xls");

$sheet6 = $xlsTemplate->getSheetByName('Sheet6');
$xls->addExternalSheet($sheet6,0);
$xls->removeSheetByIndex(1);
$xlsWriter = new PHPExcel_Writer_Excel5($xls);
$xlsWriter->save($filename."_Sheet6.xls");
PHPExcel Comment

PHPExcel Comment


By : Renato Terssetti
Date : March 29 2020, 07:55 AM
this one helps. There is no support for comments in the Excel5 writer. Use the Excel2007 writer to create an .xlsx file.
PHPExcel - How to read excel sheet with sheet id

PHPExcel - How to read excel sheet with sheet id


By : user2563990
Date : March 29 2020, 07:55 AM
wish helps you After help of Mark Baker Now I am able to get sheet data with sheet ID.
Here is full code work:
code :
<?php
/** Error reporting */
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');

/** PHPExcel_IOFactory */
require_once dirname(__FILE__) . '../PHPExcel/IOFactory.php';

$objReader = PHPExcel_IOFactory::createReader('Excel2007');

$inputFileType = 'Excel2007';
$inputFileName = 'hello.xlsx';
$sheetIndex = 2;

$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$sheetnames = $objReader->listWorksheetNames($inputFileName);
$objReader->setLoadSheetsOnly($sheetnames[$sheetIndex]);
$objPHPExcel = $objReader->load($inputFileName);
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);

echo "<pre>";
    print_r($sheetData);
echo "</pre>";
?>
Read excel data Sheet by sheet using codeigniter and mysql and phpexcel

Read excel data Sheet by sheet using codeigniter and mysql and phpexcel


By : user2867482
Date : March 29 2020, 07:55 AM
will be helpful for those in need You can access to differents sheets of a file with PHPExcelReader this way:
code :
$filename = "path/to/filename.xls";
$reader = new Spreadsheet_Excel_Reader(); // Your PHPEXCELREDER Class
$reader->setOutputEncoding('UTF8');
// Read XLS File
$reader->read($filename);
$sheet = 2; // Your sheet

// Then walk trough your wanted sheet:

for ($i = 2; $i <= $reader->sheets[$sheet]['numRows']; $i++) {
// Do something
}
PHPExcel Sorting a sheet and create a new sheet

PHPExcel Sorting a sheet and create a new sheet


By : syeda
Date : March 29 2020, 07:55 AM
it helps some times Depends how much memory you have - I'd use the Worksheet's toArray() method to copy the cells from the main sheet to a PHP array, then you can use usort() to sort that array however you like, then create a new worksheet and use fromArray() to populate it with the sorted data - but for 20,000 rows, you need enough memory to hold that data as an array in memory.
Related Posts Related Posts :
  • Php how to check multiple times (within `foreach`) if values from array exists in mysql?
  • MySQL and PHP parsing strange string
  • Pull specific data from multidimensional associative array
  • How to get the original URI extension using PHP Tonic?
  • Upload videos and images from Android to PHP server?
  • Unset a multidimensional array with another multidimensional array with values than key
  • Calling a user e-mail to add to a mailto link PHP
  • Why is override_function coming back as an undefined function
  • PHP mySQLi_fetch_all: iterate through each row
  • Using pow in php
  • What's wrong with my PHP Script? T_String issue
  • how to call a function of another file without including that file
  • is_rgb function in php
  • transform the numbers to letters using php
  • How to catch an exception from another class method PHP
  • PHP exec is blocked by ISP
  • PHP4 to PHP5 migration character encoding. latin1 vs utf8
  • Begin Transaction not defined
  • How much harm can a user do with xss on a page unique to them?
  • How to import data from a php file to javascript variable
  • PHP and Javascript - log complete workflow
  • When I echo !!! 0 it gives me a strange result
  • jquery ajax post dies after submit
  • How to upload file with curl on sftp server
  • Advanced search using a text input to search through only one category
  • Why do I get "Non-static method App\Models\Category::products() should not be called statically" in laravel
  • Stop notices from undefined indexes in arrays
  • PHP Excel Error when entering SUM function to a cell
  • laravel 4 eloquent eager load relation count
  • click submit in html and run php code
  • Extremely frustrating behavior with Internet Explorer, Bootstrap and Respond.js
  • Vkontakte vtag issues
  • Divide the number to a correct decimal
  • mysqli_insert_query not working
  • How to make a sitemap using zend framework 1
  • Laravel: array to Model with relationship tree
  • $_SERVER['DOCUMENT_ROOT'] vs $path = $_SERVER['DOCUMENT_ROOT']
  • What is the best way to store multiple checkbox values in the database and work with it later on
  • Why does foreach copy the array when we did not modify it in the loop?
  • Receive Jquery/Ajax Post Request in PHP
  • How to better use the if(!empty()){ //codes} statement
  • PHP error mysql_close() boolean given
  • Move an image file from one server to another using PHP
  • PHP: Encoding non ISO-8859-1 charactrers into utf8
  • Handling MySQL errors in PHP
  • Object orientated mysql num_rows query in one line
  • Remove not closed html elements from end of text
  • Generate random ENUM value [PHP, MySQL]
  • Deleting data from table using jQuery and SQL
  • How to make sure the constructor is executed when I'm trying to reach a static property?
  • Trying to understand arrow next to PHP function
  • Form using external php file to show "Sucess"
  • WooCommerce - new shipping method - how to query individual product weights
  • Common integer representation over variable casting?
  • PHP - Prevent client from tampering the ID of a form
  • unexpected T_PUBLIC error
  • Types of testcases in PHPUnit
  • keeping a LDAP user logged in with PHP session
  • Detect if browser supports WebP format? (server side)
  • real_escape_string not cleaning up entered text
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org