1
$\begingroup$

Apparently SemanticImport fails to properly import Excel files when accented letters are present in the first (header) row. I'm using Excel 2013 on Windows 8.1 x64 with Mathematica 10.0.2.

I tried different most obvious CharacterEncoding options without success.

Is this a bug?

Or does exists a proper option to use?

$\endgroup$
1
$\begingroup$

I'm actually using the following workaround, based on Import and manual construction of the Dataset expression. This also allow me to specifiy in the header row an optional unit for each column (as a string in parenthesis at the end of the column name).

data = Import[
   "Preliminary Reference Earth Model (PREM).xlsx", {"Data", 1}, 
   Path -> NotebookDirectory[]];
keys = StringReplace[#, " (" ~~ x__ ~~ ")" ~~ EndOfString :> ""] & /@ 
   data[[1]];
units = StringCases[#, " (" ~~ x__ ~~ ")" ~~ EndOfString :> x] & /@ 
   data[[1]];
units = Map[Quantity[None, #] &, units, {2}] /. {} -> 1 // Flatten;
Dataset[AssociationThread[
     keys, #] & /@ ((Rest[data]\[Transpose]*units)\[Transpose])]

From this file:

Excel file

I get this Dataset (not perfect, fist column should be an Integer):

Mathematica graphics

while with SemanticImport the column "LaméFirstParameter" becomes "LaméFirstParameter":

Mathematica graphics

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.