Changes

Jump to navigation Jump to search
16 bytes added ,  16:18, 11 February 2017
{{Mark|Updated with Version 8.6}}: improved Excel compatibility
The In the following table, all available options are available (the listed. The Excel column indicates what are the preferred options for converting data that is to be imported, or has been exported from Excel data):.
{| class="wikitable sortable" width="100%"
|- valign="top"
| {{Code|separator}}
| Defines the character which separates the entries values of a single record in a single line.
| {{Code|comma}}, {{Code|semicolon}}, {{Code|colon}}, {{Code|tab}}, {{Code|space}} or a ''single character''
| {{Code|comma}}
'''Query:'''
<pre class="brush:xquery">
let $text := file:read-text('some-data.csv')
let $options := map { 'lax': false() }
let $xml input := csvfile:parseread-text($text, $options'some-data.csv')let $output := $input => csv :parse($options) = > csv:serialize($xml, $options)return $text input eq $csvoutput
</pre>
<pre class="brush:xquery">
let $text := "Name;City" || out:nl() || "John;Newton" || out:nl() || "Jack;Oldtown"
let $options :=map { <csv:options> <csv'separator':separator value=';'/>, <csv 'format' :format value='map'/>, <csv: 'header value='yes'/> </csv:options>true()}
return csv:parse($text, $options)
</pre>
'''Result:'''
<pre class="brush:xmlxquery">map { 1: map {
"City": "Newton",
"Name": "John"
},
2: map {
"City": "Oldtown",
"Name": "Jack"
Bureaucrats, editor, reviewer, Administrators
13,551

edits

Navigation menu