When I try to use Excel 2013 to import External Data from a SQL Server Data Source, it does not import the Guids.
The Query I'm using is:
SELECT * FROM TABLENAME
The table Structure is:
ThingId uniqueidentifier,
ThingName nvarchar(50)
When I explicitly ask Excel to import just the uniqueidentifier
, it imports nothing (query):
SELECT ThingId from TABLENAME
How do I get Excel to import Unique Identifiers (GUIDs) when I use the "External Data" feature?
Best Answer
Excel (for reasons I have not yet determined), cannot handle imported Guids natively. In order to import GUIDs from SQL Server, you must first change the query to CAST the Guid to an
nvarchar
. The data source query would change to:The
CAST
function ensures that the GUID is in a format that Excel interprets as text. Any format that outputs text will do; it doesn't have to benvarchar
.