It is a bug.
The source of the problem is the presence of symbols "{"
, "}"
, "["
, "]"
or "\\"
in the URL (the list may be incomplete).
The simplest (and seemingly universal) workaround is to Export
as XLS instead of XLSX:
Export["myfile.xls", problem]
Another method is to escape the problematic symbols (may not work for local file paths):
Export["myfile.xlsx",
problem /. s_String :>
StringReplace[s, {"{" -> "%7B", "}" -> "%7D", "[" -> "%5B", "]" -> "%5D"}]]
For local file paths backslashes should be replaced by forward slashes as shown here.
UPDATE
It seems that in the most cases it is sufficient is to pass URL through URLParse
/URLBuild
route:
urls={
"http://www.faulbach.de/komxpress/DynDox.asp?Orgid={F527CBB0-4493-42D0-AAD6-149A10DD8D88}&LinkID={58899F1E-D42B-481F-B507-C3A9B136A780}",
"http://www.metropolregion-nordwest.de/downloads/datei/OTAwMDAwNDQ4Oy07L3Vzci9sb2NhbC9odHRwZC92aHRkb2NzL2Ntc3gvbWV0cm9wb2xyZWdpb24vbWVkaWVuL2Rva3VtZW50ZS9wcmFlc2VudGF0aW9uX25ldHprb256ZXB0aW9uXzIwMzBbMV0ucGRm/praesentation_netzkonzeption_2030[1].pdf",
"http://www.sueddeutsches-institut.de/ENI/PriceWaterhouseCoopers [2006] Die wirtschaftlichen Chancen alternativer Antriebsenergien am Beispiel des Hybridantriebs.pdf"};
encodedURLs = URLBuild /@ URLParse[urls];
Export["myfile.xlsx", Hyperlink /@ encodedURLs]
But it doesn't currently work for URLs containing a "Fragment"
what may indicate another bug:
URLParse["http://www.contractawards.eu/#!supplier=„Интер Бизнес 91\" ЕООД, ЕИК 010652246"]
URLBuild@%
<|"Scheme" -> "http", "User" -> None, "Domain" -> "www.contractawards.eu", "Port" -> None,
"Path" -> {"", ""}, "Query" -> {},
"Fragment" -> "!supplier=„Интер Бизнес 91\" ЕООД, ЕИК 010652246"|>
"http://www.contractawards.eu/#!supplier=„Интер Бизнес 91\" ЕООД, ЕИК 010652246"
One can try to use URLEncode
to force encoding of the "Fragment"
.
Export
with extension ".xls":Export["myfile.xls", problem]
. $\endgroup$ – Alexey Popkov Apr 18 '17 at 15:22Export
working. $\endgroup$ – Alexey Popkov Apr 18 '17 at 15:27Export
? $\endgroup$ – Alexey Popkov May 4 '17 at 14:11