how to open excel file in browser ,
i dont want some thing like force download dialog ,
i want to open excel in browser somthing like in gmail when u click the excel file in the inbox, it will show browser itself,
same like , how to do in php.
Select the file in OneDrive or SharePoint. Select the More icon. , then select Open. Select Open in (app) (such as Open in Word).
Loading a Spreadsheet File $inputFileName = './sampleData/example1. xls'; /** Load $inputFileName to a Spreadsheet Object **/ $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName); See samples/Reader/01_Simple_file_reader_using_IOFactory. php for a working example of this code.
PhpSpreadsheet is a library written in pure PHP and offers a set of classes that allow you to read and write various spreadsheet file formats such as Excel and LibreOffice Calc. In this tutorial, we are going learn how to read and write the xlsx file. You can integrate it with your database if you need.
Using PHPExcel:
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel5';
$inputFileName = 'MyExcelFile.xls';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
$objWriter->save('php://output');
exit;
EDIT
If your Excel file is Excel 2007 (xlsx) or later rather than Excel 2003 (xls) or earlier
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel2007';
$inputFileName = 'MyExcelFile.xlsx';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
$objWriter->save('php://output');
exit;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With