It took me about 7 seconds looking at the documentation
https://docs.laravel-excel.com/3.1/exports/store.html
store the file not download
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
i want download excel sheet path store in varibale how to do it any suggestion ?
$file = Excel::download(new UsersExport, 'Sales Register 2019 Cr.xlsx');
$data = array('name'=>"byte and bits");
\Mail::send('front.mail', $data, function($message) use($path){
$message->to('[email protected]')
->subject('Sales Register 2019 Excelsheet');
$message->from('[email protected]','byte and bits');
$message->attachData($path,'Sales Register 2019 Cr.xlsx');
});
It took me about 7 seconds looking at the documentation
https://docs.laravel-excel.com/3.1/exports/store.html
store the file not download
Instead of download you should use one of the other export methods. You can find all the details here: https://docs.laravel-excel.com/3.1/exports/store.html
@SNAPEY - i can try already but
error The Response content must be a string or object implementing __toString(), "boolean" given.
cant understand please guide me
@BOBBYBOUWMANN - i try already but error fire
$file = Excel::store(new UsersExport, 'Sales Register 2019 Cr.xlsx');
$data = array('name'=>"byte and bits");
\Mail::send('front.mail', $data, function($message) use($file){
$message->attachData($file,'Sales Register 2019 Cr.xlsx');
});
The Response content must be a string or object implementing __toString(), "boolean" given.
I can't see in the docs that the store method returns anything ? Your error would imply that a boolean is returned suggesting a true/false state for the store.
You need to construct the filepath yourself.
try
$filename = 'Sales Register 2019 Cr.xlsx';
Excel::store(new UsersExport, $filename);
$file = storage_path($filename);
steel my screen print like D:\laragon\www\hello\storage\Sales Register 2019 Cr.xlsx
and my mail succesfully send but file not open correcupted like popup
I don't know what that lot means.
@SNAPEY - run the code file can;t export and mail send but excel file cannot open in mail
$file = 'C:\Users\Vandan\Downloads';
Excel::download(new UsersExport,$file);
$file = storage_path($file);
$data = array('name'=>"byte and bits");
\Mail::send('front.mail', $data, function($message) use($file){
$message->to('[email protected]')
->subject('Sales Register 2019 Excelsheet');
$message->from('[email protected]','byte and bits');
$message->attachData($file,'Sales Register 2019 Cr.xlsx');
});
User::truncate();
return $file;
Why did you not just copy my example?
Where is the filename here
$file = 'C:\Users\Vandan\Downloads';
Excel::download(new UsersExport,$file);
$file = storage_path($file);
And you are still using download
@SNAPEY - sorry use store and steel error
No ReaderType or WriterType could be detected. Make sure you either pass a valid extension to the filename or pass an explicit type.
$file = 'import_file';
Excel::store(new UsersExport,$file);
$file = storage_path($file);
actually i try to export excel file with mail send excelsheet so this code is valid or not any suggestion please
Make sure you either pass a valid extension to the filename
WTF 'import_file'
@BOBBYBOUWMANN - please help me i try to export file with mail send excelsheet so my code is valid or not?
$filename = 'Sales Register 2019 Cr.xlsx';
Excel::store(new UsersExport, $filename);
$file = storage_path($filename);
see above? See .xlsx? Thats the file extension.
@SNAPEY - Try ALready Not Working
$filename = 'Sales Register 2019 Cr.xlsx';
Excel::store(new UsersExport, $filename);
$path = storage_path($filename);
output only file path display in excel file not record fetch look like : "D:\laragon\www\hello\storage\Sales Register 2019 Cr.xlsx"
Well like Jeffrey reminded me one time we were all new to this stuff at one time.
Why don't you go to that site and actually work some of those examples and just take your time and learn how to do it correctly.
@JLRDW - ok i learn it but please help me out this error first
I would say work those examples first that way you will learn. Bedtime here in Texas.
When you run this code, does it create the file in the storage folder?
$filename = 'Sales Register 2019 Cr.xlsx';
Excel::store(new UsersExport, $filename);
$file = storage_path($filename);
You then need your original code to send an email with $file as an attachment
Have you tried that?
@SNAPEY - yes i try this see
$filename = 'Sales Register 2019 Cr.xlsx';
Excel::store(new UsersExport, $filename);
$path = storage_path($filename);
$data = array('name'=>"byte and bits");
\Mail::send('front.mail', $data, function($message) use($path){
$message->to('[email protected]')
->subject('Sales Register 2019 Excelsheet');
$message->from('[email protected]','byte and bits');
$message->attachData($path,'Sales Register 2019 Cr.xlsx');
});
Amazing.
@JLRDW - what do you mean amazing ?
@VANDAN - I figured you had it working.
"Yes I try this see"
What does that tell me? How am I supposed to help?
@SNAPEY - when file send to mail but file can't open may be file not send correct path so how to correct solution for this code
when i try to downlaod file error like file is correcpted or not valid extension
@SNAPEY - i try hard
$filename = '.xlsx';
Excel::store(new UsersExport, $filename);
$path = storage_path($filename);
after file successfully download but data cant fetch
look like only path can store in downlaod file
Unfortunately I cannot teach you how to use a computer through this forum.
@SNAPEY - sort and sweet
maatwebsite packages use in my project i try to export excel file and mail send while file export
how to mail send with excel file here is my code
i cant sleep to 2 days beacuse my code was not excute so please help me out
attachData() attaches raw data, not a file from disk.
Use attach() instead.
@FTIERSCH - i try this attach()
error fire Unable to open file for reading [D:\laragon\www\hello\storage.xlsx]
Please or to participate in this conversation.