PHPOffice / PhpSpreadsheet

A pure PHP library for reading and writing spreadsheet files
https://phpspreadsheet.readthedocs.io
MIT License
13.26k stars 3.42k forks source link

Export to csv from excel including hyperlink #1412

Open CmdrMahesh opened 4 years ago

CmdrMahesh commented 4 years ago

Hi PHPOffice,

I am looking for a way to export my XLSX file to CSV where some columns have a hyperlink and I could not figure out how to export the file with a hyperlink instead of the text on which hyperlink is applied.

here is my code to export to CSV:

require constant('EO_ECIE_DIR').'vendor/autoload.php';              
 $xl_reader = new Xlsx();
 $sheets = $xl_reader->load(self::$_file);

 $sheet_names = $sheets->getSheetNames();

 $csv_writer = new Csv($sheets);
 if(is_array($sheet_names) and !empty($sheet_names[0])){

    $csv_writer->setSheetIndex(0);                  
       $csv_writer->save(self::$_file.'.csv');
       self::$_file = self::$_file.'.csv';
}

Help is appreciated as I have already googled a lot before writing a query here.

Thanks in advance.

MarkBaker commented 4 years ago

This isn't something that PHPSpreadsheet does; what wold you expect to see in the CSV file for a cell containing a hyperlink?

CmdrMahesh commented 4 years ago

I would like to extract those hyperlinks if they have any instead of the text label.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue for you, please try to help by debugging it further and sharing your results. Thank you for your contributions.