Download to excell

  I have some code  similar to  

                 
				        $header =  "Photo" . ",";
        				$dataline = "";    				
        				foreach ($pages as $page) { 									
        					$current_post_meta = get_post_meta($page -> ID);					
        					$data = "";	
        					$upload_a_photo = trim($current_post_meta['upload_a_photo'][0]);
        					$upload_a_photo = str_replace('"', '""', $upload_a_photo);
        					if (trim($upload_a_photo) !== "") {
        						$upload_a_photo  = "http://blaa/" . $upload_a_photo;  
        					}	
        					
        					$data = $data . $upload_a_photo . ",";
        					
        					$dataline .= trim($data) . "\n";	
        				}
        				
        				ob_end_clean ();
        								
        				header("Content-type: text/csv");
        				header("Content-Disposition: attachment; filename=spikes_sightings.csv");
        				header("Pragma: no-cache");
        				header("Expires: 0");
        				echo $header . "\n" . $dataline; 
        				exit;	

The result in the excel cell isn’t a hyperlink. Is there a way to make it a hyperlink please?

csv and excel are different. If you want to specifically target Excel, you need to add the library that targets it to maintain its features.

What library is that so that I know for another time? My client is quiet happy with it not being clickable this time but you never know they might change their mind or some one else in the future might need it. Thanks

there’s a lot, just search for php excel on Github.

Thanks for all you help

Sponsor our Newsletter | Privacy Policy | Terms of Service