1. Home
  2. Run ODBC Export Link (GLK) file

Run ODBC Export Link (GLK) file

Select menu: Spread | Export | Run ODBC export link

This dialog lets you run an ODBC Export Link (GLK) file that has previously been saved using either the Export Insert or Merge menus. Thus the same options set in a previous export to the database can be reused. A GLK file is a text file containing header information that Genstat recognises. If a GLK file is open with the usual File | Open menu, then you can either open it as a plain text file to edit, or run it to update the specified database. GLK files can be used with the command DBEXPORT to programmatically update an ODBC database from a batch job. The structure of the GLK file is specified below.

  1. From the menu select Spread | Export | Run ODBC export link.

Export file

Specifies the name of a Genstat ODBC Export Link file (*.GLK), which contains the saved specification of the update to be used on the ODBC database. You can select a file using the Browse button.


This opens a File Open dialog to specify the name of a GLK file to run against the current spreadsheet window or an existing Genstat spreadsheet (GSH) file specified within the GLK file.

Data to export to database

  • Use currently active sheet – Use the data in the currently active spreadsheet window (the window from which the dialog was opened). The file name of the current sheet is displayed on the line beneath this option.
  • Use sheet specified in export file – Open and use the GSH file specified within the GLK file. The GSH file referenced in the GLK file is displayed in the edit field beneath this option, and can be edited to use a different spreadsheet file, or changed with the associated Browse button to the right of the edit field.

View or edit export before running it

This opens the appropriate Create/Insert/Merge dialog with the options specified in the GLK file before running the export against the ODBC database. Thus the options can be altered before running the export.

GLK file specification

The order of lines 7-12 can be interchanged without effecting the export.

  Line Contents Description
1. [Genstat ODBC Update] GLK File type flag
2. <DNS> Database connection string
3. <GSH Filename> GSH Spreadsheet file to be loaded into table
4. TEMPORARY/PERMANENT Marker that GSH file is to be deleted
5. <Update Mode> Create, Insert, Merge (C,I,M)
6. <Table Name> Name of Table to be updated

0 = Halt only on fatal error, not warnings
1 = Halt the export if any error occurs

8. RESTRICTION=<0,1> 0 = Ignore any restriction on inserting rows (C,I only)
1 = Do no add in restricted rows
9. ADDCOLUMNS=<0,1> 0 = Do not add columns not found in table (I,M only)
1 = Add new columns to table
10. SUBSET=<0,1> 0 = Use all columns in Spreadsheet (I,M only)
1 = Only use a subset of columns
(subset must be provided as column no.s)
11. BYNAME=<0,1> 0 = Names will be provided for table columns
1 = Use spread names for table columns
12. ACTION=<0,1,2> 0 = Do not add unmatched rows (M only)
1 = Add in extra unmatched rows if a match exists
2 = Add in all extra rows
13. NCOLUMNS=<n> Add in this number of columns
(needed if Subset=1 or ByName=0)
  <Colno>=<TColName> x n Insert column <Colno> into Table
(as <TColName> if ByName = 0)
14+ NMATCH=<m>
<Colno>=<TColName> x m
Match this number of columns (M only)
Match column <Colno> with Table column <TColName>

See also

Create New Database Table from Spreadsheet
Insert Spreadsheet into Database
Merge Spreadsheet into Database
ODBC Data Query – Select Data
ODBC Databases
SQL Statements
Using ODBC with 64bit Windows
DBIMPORT procedure

The DBEXPORT procedure provides this functionality within the command language.

Updated on July 11, 2019

Was this article helpful?