Comprehensive Guide to gsqlcmd Parser Options

Comprehensive Guide to gsqlcmd Parser Options

/asIs

Use this option to disable any special processing of the input data, such as converting Yahoo Finance timestamps to datetime values.

/attributedColumns=<col>.<attr>[;...]

This option creates output columns from XML attribute values.

For example, if Zoho CRM exports data like:

<FL val="FirstName">John</FL>
<FL val="LastName">Doe</FL>

You can extract values into the FirstName and LastName columns using:

/attributedColumns=FL.val

/collapsedNodes=<node>[;...]

Use this option to include XML child node values in the parent node.

For example, consider the following XML structure:

<passages>
<passage><hlword>Yandex</hlword> - the search engine that can...</passage>
</passages>

To consolidate this into a single passages column, use:

/collapsedNodes=passages

/firstRow=<first row>

Use this option to specify the first data row in the input file.

/firstRowHasNames

Use this option to indicate that the input data includes headers, especially if gsqlcmd does not detect them.

This option is the opposite of the /noSourceHeaders option.

You can also set this option to false, like so:

/firstRowHasNames=false

/hasRowNum

Use this option to indicate that the first column contains row numbers.

You can skip this option if the first column is named _RowNum.

This option prevents adding an additional column with the /addRowNum option, like so:

/hasRowNum /addRowNum

You can also combine this option with /addRowNum to exclude the first column:

/hasRowNum /addRowNum=false

/ignoredTags=<tag>[;...]

Use this option to prevent creating columns for specified XML tags.

For example, given the following XML structure:

<passages>
<passage><hlword>Yandex</hlword> - the search engine that can...</passage>
</passages>

To ignore the hlword tag, use:

/ignoredTags=hlword

/inputCodePage=<codepage>

Use this option to specify the input file's code page.

For example:

/inputcodepage=65001

/inputDateFormat=DMY | MDY

Use this option to define the date-month order of the input data.

gsqlcmd attempts to detect this order automatically. However, you should specify it if a column contains ambiguous dates, such as 1/12/2019 or 12/1/2019.

/inputSeparator=<separator> | Tab

Use this option to define the input CSV separator.

gsqlcmd usually detects it automatically.

/keptNodes=<node>[;...]

Use this option to specify XML and JSON nodes that should be included in the output, even if they have no values.

This option helps maintain consistent output columns for files with small datasets where some columns may be empty.

/noSourceHeaders

Use this option when the first row of CSV, text files, or HTML table headers does not contain column names.

In this case, gsqlcmd generates columns with names like F1, F2, etc.

This option is particularly useful for financial statements that use years or quarters as column headers.

This option is the opposite of the /firstRowHasNames option.

/numberFields=<field>[<separator>...]

Use this option to force the conversion of column values to numbers.

For example:

/numberColumns=Open;High;Low;Close;Volume

Without this option, gsqlcmd skips conversion for any column containing a non-convertible value.

/requiredColumns=<name>[;...]

Use this option to specify the columns that are required for output.

gsqlcmd will not process the file if it does not contain the specified columns.

For example, if you want to load dividends for a list of symbols, you can specify required output columns to skip pages for companies that do not pay dividends:

gsqlcmd convert https://www.nasdaq.com/symbol/aapl/dividend-history aapl.csv /requiredColumns=ExEffDate;Type

/rootPath=<path>[;...]

Use this option to explicitly define the roots of the output columns.

Here are several examples for XML, JSON, and HTML sources:

/rootPath=.InvoiceTransmission.Invoice
/rootPath=calls,puts
/rootpath=*.*.timestamp,*.*.*.quote,*.*.*.adjclose
/rootPath=1

Without this option, gsqlcmd automatically detects output columns.

Use the show-roots mode to get roots for XML and JSON files.

Use the show-html-tables mode to identify table numbers used as roots for HTML files.

gsqlcmd supports multiple roots for JSON and HTML, and a single root for XML.

/skippedNodes=<node>[;...]

Use this option to exclude XML or JSON nodes from the output.

You can specify column paths like parent1.parent2.column or suffixes like .column.

For example, to exclude columns with data types, use:

/skippedNodes=.type

/stringFields=<field>[<separator>...]

Use this option to prevent the conversion of column values to numbers.

For instance, this option allows you to keep values like "2.10" as strings.

Without this option, the tool converts the value to a numeric value, such as 2.1.

For example, to retain versions and zip codes as strings, use:

/stringColumns=Version;ZipCode

This website is using cookies. By continuing to browse, you give us your consent to our use of cookies as explained in our Cookie Policy.