SemanticImportString ["string"]
attempts to import a string semantically to give a Dataset object.
SemanticImportString ["string",type]
attempts to interpret all elements in the string as being of the specified type.
SemanticImportString ["string",{type1,type2,…}]
attempts to interpret elements in successive columns as being of the specified types.
SemanticImportString ["string",col1->type1,col2->type2,…]
attempts to interpret elements in the named columns as being of the specified types.
SemanticImportString ["string",typespec,form]
puts the result in the specified form.
SemanticImportString
SemanticImportString ["string"]
attempts to import a string semantically to give a Dataset object.
SemanticImportString ["string",type]
attempts to interpret all elements in the string as being of the specified type.
SemanticImportString ["string",{type1,type2,…}]
attempts to interpret elements in successive columns as being of the specified types.
SemanticImportString ["string",col1->type1,col2->type2,…]
attempts to interpret elements in the named columns as being of the specified types.
SemanticImportString ["string",typespec,form]
puts the result in the specified form.
Details and Options
- SemanticImportString has identical functionality to SemanticImport , except that it takes its input from a string rather than the contents of a file.
- SemanticImportString takes the following options:
-
CharacterEncoding "UTF-8" character encoding in the response body
Examples
open all close allBasic Examples (6)
Import a string semantically:
Import a string as a single column of strings:
Import a string with the specified column types:
Import only some columns of a string, in the specified format, using column numbers:
Import only some columns of a string, in the specified format, using column names:
Import a string as a list of named rows:
Scope (4)
Import a string using the given delimiter:
Specify that the first line of the string to import is a header:
Specify that the first and third lines of the given string should be skipped:
Return missing values with the form "Unknown" in the special form Missing ["UnknownData"]:
Options (9)
Delimiters (2)
Specifying the delimiter determines how values are separated:
Import semicolon-delimited values instead:
Delimiters within quotations are ignored:
ExcludedLines (1)
Specify lines that should not be processed:
HeaderLines (2)
If a header is detected, the first element in a column is used:
When a header is not detected, the header is an index within a string (such as "column1", "column2"):
Specify the number of header lines explicitly:
MissingDataRules (4)
Replace strings that start with "no" by a missing zero:
Match inputs by regular expression:
Lists of lists of rules are applied column by column:
Rules are applied before interpretation:
Applications (3)
Import a list of quantities as a Dataset object:
Import quantities as an array:
Import countries:
Get the contents of a file:
Apply any string transformations to the input file. In this case, the full text is simply set to uppercase:
Import the data contained in the string:
Import the price column only:
Possible Issues (4)
The interpretation of data depends upon its context. Without further context, "12,3" is interpreted as a date:
In the context of the value "45,4", which is not a valid date, "12,3" is interpreted as two integers:
SemanticImportString , unlike SemanticInterpretation , does only simple, quick inferences. SemanticImportString imports state names as strings:
SemanticInterpretation imports state names as Entity objects:
Automatic type selection chooses from a smaller set of interpretations rather than specifying a type explicitly:
An Automatic type specifies an automatically selected number of columns:
An {Automatic } type specifies a single column of automatically selected type:
Automatic in a type list applies to the corresponding column sequentially:
See Also
SemanticImport SemanticInterpretation Interpreter WolframAlpha ImportString Dataset
Function Repository: AddSemantics
Related Guides
History
Text
Wolfram Research (2014), SemanticImportString, Wolfram Language function, https://reference.wolfram.com/language/ref/SemanticImportString.html.
CMS
Wolfram Language. 2014. "SemanticImportString." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SemanticImportString.html.
APA
Wolfram Language. (2014). SemanticImportString. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SemanticImportString.html
BibTeX
@misc{reference.wolfram_2025_semanticimportstring, author="Wolfram Research", title="{SemanticImportString}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/SemanticImportString.html}", note=[Accessed: 17-November-2025]}
BibLaTeX
@online{reference.wolfram_2025_semanticimportstring, organization={Wolfram Research}, title={SemanticImportString}, year={2014}, url={https://reference.wolfram.com/language/ref/SemanticImportString.html}, note=[Accessed: 17-November-2025]}