Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9025005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:09:56+00:00 2026-06-16T06:09:56+00:00

Am working with large excel file I have removed limits is there a way

  • 0

Am working with large excel file I have removed limits is there a way I can read through my cells much quicker. I have 6000 rows and reducing the tmp folder in my wamp folder.

set_time_limit(0);
ini_set('memory_limit', '-1');
include'../Classes/PHPExcel.php';
include'../Classes/PHPExcel/IOFactory.php';
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
$cacheSettings =    array( ' memoryCacheSize ' =>'8MB');    
PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
$objReader = new PHPExcel_Reader_Excel2007();
$objPHPExcel = $objReader->load('Book1.xlsx');
$highestRowEM = $objPHPExcel->getActiveSheet()->getHighestRow();
echo $highestRowEM;
for($i=0;$i<$highestRowEM;$i++){
    $varval=$objPHPExcel->getActiveSheet()->getCell('A'.$i)->getValue();
    if($varval==""){
        break;
    }
}
echo $i;
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('Book1.xlsx');

What to clean up workbooks with worksheets with , in them

  `include'../Classes/PHPExcel.php';
  include'../Classes/PHPExcel/IOFactory.php';
  set_time_limit(0);
  ini_set('memory_limit', '-1');
  $xlsxfiles=$_SESSION['file'];
  echo $xlsxfiles;
  echo "<br>";
  $objReader = PHPExcel_IOFactory::createReader('Excel2007');
  $objPHPExcel = PHPExcel_IOFactory::load('../upload/'.$xlsxfiles);
  $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, "Excel2007");
  ////Validation
  foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
      $highestRow = $worksheet-> getHighestDataRow();
      $columnhighest=$worksheet->getHighestDataColumn();
      $columnhighestval=array_search($columnhighest, $alphabet);
      echo 'Worksheet - ' , $worksheet->getTitle()." Number of rows: ".$highestRow."<br>";
      for($cl=0;$cl<$highestRow+1;$cl++){
          for ($ga=1;$ga<$columnhighestval;$ga++){
              $letters=strtoupper($alphabet[$ga]);
              $clean=$worksheet->getCell($letters.$cl)->getValue();
              $cleandone=str_replace(','," ",$clean);
              $worksheet->setCellValue($letters.$cl,$cleandone);
          }
          $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
      }
  }
  $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, "Excel2007");
  $objWriter->setOffice2003Compatibility(true);
  $objWriter->save('../upload/'.$xlsxfiles);
  echo "Done";
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T06:09:57+00:00Added an answer on June 16, 2026 at 6:09 am

    Tip 1:

    replace

    for($i=0;$i<$highestRowEM;$i++){
        $varval=$objPHPExcel->getActiveSheet()->getCell('A'.$i)->getValue();
    

    with

    $objSheet = $objPHPExcel->getActiveSheet();
    for($i=0;$i<$highestRowEM;$i++){
        $varval = $objSheet->getCell('A'.$i)->getValue();
    

    Then you’re not calling $objPHPExcel->getActiveSheet() in every iteration of the loop.

    Then tell us what you’re actually trying to do with the worksheet data, and we may be able to help speed it up a bit more

    EDIT

    Don’t set the cell value unless you have to;
    Don’t instantiate the Writer until you need it, and definitely not in the loop;
    Instead of using $letters and $alphabet, use the routines built-into PHPExcel, or take advantage of PHP’s Perl-style character incrementor;
    Don’t do maths in your loop comparisons

      ////Validation
      foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
          $highestRow = $worksheet->getHighestDataRow();
          $columnhighest=$worksheet->getHighestDataColumn();
          $columnhighest++;
          echo 'Worksheet - ' , $worksheet->getTitle()." Number of rows: ".$highestRow."<br>";
          for($cl = 0; $cl <= $highestRow; $cl++){
              for ($ga='A'; $ga !== $columnhighest; $ga++){
                  $clean=$worksheet->getCell($ga.$cl)->getValue();
                  $cleandone=str_replace(','," ",$clean);
                  if($clean != $cleandone) {
                      $worksheet->setCellValue($ga.$cl, $cleandone);
                  }
              }
          }
      }
      $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large data set that I'm working with in excel. About 1000+
I'm working with large numbers that I can't have rounded off. Using Lua's standard
I often jump from a file to file, while working a large codebase. I
I'm working on a large project (for me) which will have many classes and
I have been working on large datasets lately (more than 400 thousands lines). So
I have working in large application which contain c and cpp. The all files
Well, I have been working with large amount of network data. In which I
Working with Open XML 2.0 using c# to parse large excel files. Issue I'm
I am working on an Excel workbook that contains large amounts of entries in
I'm working with an excel book containing a large number of sheets; the first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.