1

Is there any way to get the cell value with exact address in Excel?

Like I upload the excel file then return sheet(2).cell(10,1).value ?

Since I am writing a website to upload a excel and put those data into DB, the file's rows and columns are automatically generated and the formats are not exactly matching maatwebsite/Excel's upload sample.

I am using Laravel 5.7 and maatwebsite/Excel 3.1

2
  • 1
    Can you show, what you have tried? Commented Apr 20, 2019 at 8:34
  • Please see Daniel's reply , he gave the ans, thanks for your comment~ Commented Apr 20, 2019 at 14:27

2 Answers 2

1

In maatwebsite/Excel 2.* you could fetch the value in the cell with

Excel::load('file.xlsx, function($excel) {
    $cell = $excel->getSheet(2)->getCellByColumnAndRow(10, 1);       
});

These methods have been removed in 3.*

However maatwebsite/Excel is just a wrapper around phpoffice/phpspreadsheet - so we can still call the function directly from that library:

$inputFileName = 'filename.xlsx';

$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);

$cellValue = $spreadsheet->getSheet(2)->getCellByColumnAndRow(10, 1)->getValue();
Sign up to request clarification or add additional context in comments.

2 Comments

it's not work for version 3.1... The load method is not exsist~
Thanks you so much! I just found out they use PhpOffice but not able to find out they use that way to read the sheet!
1

I hope this would be help to you.

1 Comment

thanks for your help but it's not work... i would like to get the value in exact address

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.