PHP Classes

Need yo get the URL from a cell with a hyperlink

Recommend this page to a friend!

      SimpleXLSX  >  All threads  >  Need yo get the URL from a cell with...  >  (Un) Subscribe thread alerts  
Subject:Need yo get the URL from a cell with...
Summary:I get the display value, but not the link URL
Messages:4
Author:Harold Spencer
Date:2016-03-11 03:01:30
 

  1. Need yo get the URL from a cell with...   Reply   Report abuse  
Picture of Harold Spencer Harold Spencer - 2016-03-11 03:01:30
This is a great class, and it has solved all of my problems except one.

The first column in the first sheet of a seven sheet xlsx file contains a HYPERLINK.

When I try and read it, I get something that displays as " URL Link". I need to get the full URL to store in my database.

Obviously, I am missing something. Can anyone help me?

  2. Re: Need yo get the URL from a cell with...   Reply   Report abuse  
Picture of Sergey Shuchkin Sergey Shuchkin - 2016-03-11 03:50:14 - In reply to message 1 from Harold Spencer
$xlsx = new SimpleXLSX('book_with_hyperlinks.xlsx');

echo '<pre>';
foreach( $xlsx->rowsEx() as $r ) {
print_r( $r );
}
echo '</pre>';

  3. Re: Need TO get the URL from a cell with...   Reply   Report abuse  
Picture of Harold Spencer Harold Spencer - 2016-03-11 05:49:39 - In reply to message 2 from Sergey Shuchkin
Thanks Sergey, for the quick reply. I'm afraid I'm still confused. Using your code, here is what I see for the cell where the link is located:

Array
(
[0] => Array
(
[type] => s
[name] => A2
[value] => 161000175
[href] => URL Link
[f] =>
[format] => General
)

[1] => Array
(
[type] => s
[name] => B2
...

I would expect to see an actual link in the [href] element. Perhaps the folks who created the spreadsheet did something weird in their hyperlink.

In the spreadsheet, cell A2 displays '161000175', which is underlined as a link. When pressed, it loads a page into my open browser.

Am I missing something?

  4. getting URL from HYPERLINK Cell with...   Reply   Report abuse  
Picture of Harold Spencer Harold Spencer - 2016-03-31 18:38:17 - In reply to message 2 from Sergey Shuchkin
Sergey,

I'm just a so-so PHP programmer. I've been able to get everything out of an xlsx file except the URL from a HYPERLINK cell.

I propose paying you to write the explicit code for my application. I will send you a file, you return code that extracts URLs from one column of the sample spreadsheet.

I propose $200, half in advance.

Any interest?

Thanks,

Harold Spencer
[email protected]