mercredi 27 mai 2020

how to get excel cell value not formula using laravel controller

Hi guys I am trying to read excel sheet data using laravel controller .

Some cell which contains the excel formula and larvel code is getting the formula not excel cell value.

Can u suggest me the function to get excel cell value not formula.

I am using the following code.

   <?php
    use Illuminate\Database\Capsule\Manager as DB;
    namespace App\Http\Controllers;
   use Illuminate\Http\Request;
   use Illuminate\Http\Response;
   use Illuminate\Foundation\Bus\DispatchesJobs;
   use Illuminate\Routing\Controller as BaseController;
   use Illuminate\Foundation\Validation\ValidatesRequests;
   use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
   use Excel;
   use File;
   use Maatwebsite\Excel\Concerns\WithCalculatedFormulas;

   class techyadeshController extends Controller 
      {
     public function excelUpload(Request $request){

             $data = Excel::toCollection("",$request->file('myFile')); //myFile name of file

                foreach ( $data as $d) {
                $i=1; // to start read excel data from 1st row not from o row
                for($i=1; $i<count($d); $i++)
                {
                 echo $d[$i][0]; // to read first column 
                 echo $d[$i][1]; // second column has excel formula here i want to read cell value

                }
            break; // to read only first excel sheet
            }

        }
     }
       ?>


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2zxJses
via IFTTT

Aucun commentaire:

Enregistrer un commentaire