'Laravel Excel beforeExport event to load excel from aws s3 bucket not working

I am using matwebsite Laravel excel to do some updates in existing excel and export. I am using beforeExport method to do some updates in the excel. when i provide my local server path it works great but if i use amazon s3 bucket path it is not working. here in below $awsPath not working. if I use my local server file then it works

public static function beforeExport(beforeExport $event)
{
  $event->writer->reopen(new LocalTemporaryFile($awsPath),Excel::XLSX)
}

it returns below error

exception: "PhpOffice\PhpSpreadsheet\Reader\Exception" file: "vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Shared\File.php" line: 149 message: "File "" does not exist."



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source