简体   繁体   中英

Formula to get data from other sheet always return lowercase in PhpSpreadsheet

I am using PhpOffice\\PhpSpreadsheet

I have 2 sheets in the excel and I need the First sheet "Sheet1" with formulas that involves "Sheet2" . (in future sum, rest, etc) When I tried this

$ac = $spreadsheet1->getActiveSheet(0);
$ac->setCellValue('B1', "=Sheet2.B1");

It always is converted to "=sheet2.b1" (lowercase in the excel) and the formula does not work

Any solution?

Try quoting the sheet name, and using ! to reference the cell:

$ac = $spreadsheet1->getActiveSheet(0);
$ac->setCellValue('B1', "='Sheet2'!B1");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM