Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export to csv from excel including hyperlink #1412

Closed
CmdrMahesh opened this issue Mar 7, 2020 · 3 comments · Fixed by #4151
Closed

Export to csv from excel including hyperlink #1412

CmdrMahesh opened this issue Mar 7, 2020 · 3 comments · Fixed by #4151

Comments

@CmdrMahesh
Copy link

CmdrMahesh commented Mar 7, 2020

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
Copy link
Member

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

@CmdrMahesh
Copy link
Author

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

@stale
Copy link

stale bot commented May 10, 2020

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.

@stale stale bot added the stale label May 10, 2020
@stale stale bot closed this as completed May 17, 2020
@oleibman oleibman reopened this Aug 26, 2024
@stale stale bot removed the stale label Aug 26, 2024
oleibman pushed a commit to oleibman/PhpSpreadsheet that referenced this issue Aug 26, 2024
Fix PHPOffice#1412 which had gone stale and which I've reopened. Add boolean property `preferHyperlinkToLabel` with setter and getter to Csv Writer. Default is false, so no BC problems; in addition, true will probably add quite a bit of overhead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants