Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.4
9.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
Statistic
FMM
Blog
FM.InsertRecordCSV
Inserts records based on CSV text.
Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
FM FMSQL | 7.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
InsertFileName | The file name of where the insert table is inside. Can be empty to look for the table in all files. |
Get(FileName) | |
InsertTableName | The name of the table to insert record into. Can be ID of table, so we lookup name by ID. Can be result of GetFieldName() function as we remove field name automatically. |
"Assets" | |
FieldNames | A list of field names for the insert. Empty entries in the list are ignored. |
"Model" | |
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 | Available in MBS FileMaker Plugin 8.5 or newer. The delimiter to use. If empty, we auto detect it. |
";" | Optional |
FieldName | A field name to set. | "Model" | Optional |
FieldValue | 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. |
"Test" | Optional |
Result
Returns OK or error.
Description
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. Since version 8.2 we can fill text, number, time, timestamp and date fields and let FileMaker convert the values with your current locale.
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.
Examples
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
- FM.ExecuteSQL
- FM.ExecuteSQL.LastError
- FM.ExecuteSQL.LastErrorMessage
- FM.InsertRecord
- FM.InsertRecordQuery
- FM.InsertRecordTSV
- List.CSVSplit
Example Databases
Blog Entries
- MBS FileMaker Plugin, version 9.3pr2
- MBS FileMaker Plugin, version 9.2pr1
- MBS FileMaker Plugin, version 8.5pr3
- MBS FileMaker Plugin, version 8.2pr1
- MBS FileMaker Plugin, version 7.6pr5
- CSV functions in MBS FileMaker Plugin
- MBS FileMaker Plugin 7.4 - More than 4900 Functions In One Plugin
- MBS FileMaker Plugin, version 7.4pr8
FileMaker Magazin
Release notes
- Version 9.3
- Rewrote FM.InsertRecordCSV to support multi line values.
- Version 9.2
- Fixed problem with delimiter detection in FM.InsertRecordCSV.
- Version 8.5
- Added delimiter parameter for List.CSVSplit, QuickList.CSVSplit and FM.InsertRecordCSV.
- Version 8.2
- Improved FM.InsertRecordCSV and FM.InsertRecordTSV to handle date/time/timestamp fields.
- Version 8.0
- Changed FM.InsertRecordCSV and FM.InsertRecordTSV to detect whether columns are numbers instead of text and handle it correctly.
- Version 7.4
- Added CSV functions: FM.InsertRecordCSV, List.CSVSplit and QuickList.CSVSplit.
Created 21st September 2017, last changed 1st May 2020
FM.InsertRecord - FM.InsertRecordQuery
Feedback: Report problem or ask question.

Links
MBS FileMaker blog