Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 8.2   8.3   8.4   8.5   9.0   9.1   9.2   9.3   9.4   9.5    Statistic  


Inserts records based on CSV text.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
FM FMSQL 7.4 Yes Yes Yes Yes Yes
MBS( "FM.InsertRecordCSV"; InsertFileName; InsertTableName; FieldNames; Text { ; Delimiter; FieldName; FieldValue } )   More


Parameter Description Example value
InsertFileName The file name of where the insert table is inside.
Can be empty to look for the table in all files.
InsertTableName The name of the table to insert record into. "Assets"
FieldNames A list of field names for the insert.
Empty entries in the list are ignored.
Text The text to import in TSV/CSV format.
This means tab, comma or semicolon character between fields and newline character for new records.
Use Files.ReadTextFile if needed to read this from a file on disk.
"Bob;Miller;12345;New York"
Delimiter Optional
Available in MBS FileMaker Plugin 8.5 or newer.
The delimiter to use.
If empty, we auto detect it.
FieldName Optional
A field name to set.
FieldValue Optional
A field value to use for setting the field in the parameter before.
Data type of parameter must match the data type of the field.


Returns OK or error.


Inserts records based on CSV text.
This function allows for easy importing of text to create a log of records.
Filename parameters can be empty.
Use FM.ExecuteSQL.LastErrorMessage and FM.ExecuteSQL.LastError to see error message.
Reports an error if field name list doesn't match column count of the query result. The fields must be of type text. You can later use a script to copy values in whatever format you need.
Returns number of records added.

CSV is automatically parsed per line with List.CSVSplit function internally.

You can pass one pair of field name and value for each extra field you like to set in the new records. e.g. a reference ID.

You can specify fields and table via IDs and the plugin will lookup them for you at runtime. Table IDs and table names must be unique across all open files for this to work correctly.

With plugin version 8.4 or newer, you can use GetFieldName() function to query field names and the plugin removes the table prefix with :: in the field name before passing it to SQL engine.

Version 8.5 adds Delimiter parameter, which may break scripts, but we need to have that parameter for people with older version.


Import some contacts with passing import ID/timestamp:

MBS( "FM.InsertRecordCSV"; "Contacts.fmp12"; "Contacts"; "FirstName¶LastName¶City"; $tsv; "ImportID"; $importID; "ImportDate"; Get(CurrentHostTimeStamp))

Import CSV:

MBS( "FM.InsertRecordCSV"; "Kontakte.fmp12"; "Kontakte"; "Vorname¶Nachname¶Firma¶Position"; "Vorname;Nachname;Firma;Position")

See also

Example Databases

Blog Entries

Release notes

Created 21st September 2017, last changed 27th June 2019

FM.InsertRecord   -   FM.InsertRecordQuery

Feedback: Report problem or ask question.

MBS FileMaker Plugins