Please enable JavaScript to view this site.

Vensim Help

Navigation: Reference Guide > Functions > Data Functions

GET DIRECT DATA('file','tab','time row or col','cell') GET DATA DIRECTly from a file

Scroll Prev Top Next More

Returns time series data from a file for a Data variable or a vector of Data variables.

Restrictions: Must appear directly following the data equals sign := and not be followed by anything.  

The GET DIRECT DATA function is invoked during simulation setup, before the active simulation begins.

Vensim will need to open the file to read it. This means the file must not be opened in another application. This function supports Microsoft Excel (.xls or .xlsx) files. It also supports text files that contain delimited data. By default Vensim will look for tab delimited data unless the extension on the  file is .csv in which case Vensim will look for comma delimited values. You can specify an alternative delimiting character in the second argument to the function when opening plain text files.

All of the arguments to GET DIRECT DATA must be literals (enclosed in single quotes ') or String Variables. 'file' names a file with complete extension to read from (use '?Tag' to indirectly reference a file and resolve the reference in Model>Settings>XLS Files).  It should be in the same directory as the current mode. 'tab' names the tab that contains the Data for excel files or the delimiter for text files. 'time row or col'  is either the number of the row containing Time values (Time running across) or the letter of the column containing Time values (Time running down).  Note that the spreadsheet file must contain values for Time and  these values must be Time values and not those of an alternate Time Base.  The convention of column letters beginning with A and row numbers beginning with 1 is used for all file types. 'cell'  names the cell that the first Data value is on.  Vensim will read values for different times across or down depending on the 'time row or col' argument.  Vensim will also read additional subscript elements in the other direction.


       This function does not open Excel, and may fail if the file is opened in Excel or another application.
Vensim will continue to read the Time row or column to the end of the file, ignoring any blank or nonnumeric cells.
Changes to String Variables made in .cin files (or through Venapp commands) will not be used when determining file, tab or cell.



Units: GET DIRECT DATA is not part of units checking.  Specify units for the left hand side variable.



NOTE On the Macintosh GET XLS DATA and GET DIRECT DATA are the same.

Availability:  Not PLE.

See also: GET XLS DATA

Sample model: GET DIRECT DATA.mdl  and GET DIRECT DATA[ss].mdl in FunctionExamples