Matrix.CSVSplit
---------------

Splits CSV text.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Matrix](component_Matrix.md) | [10.5](newinversion105.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Matrix.CSVSplit"; Text { ; Delimiter; Flags } ) 

**MBS**( **"Matrix.CSVSplit";** /\* Splits CSV text. \*/  
**$Text**; /\* The CSV text.e.g. "Hello;World" \*/   
**$Delimiter**; /\* Optional; The delimiter to use.  
If empty, we auto detect it.e.g. ";" \*/   
**$Flags**) /\* Optional; Pass 1 to move first row into column names.e.g. 1 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Text | The CSV text. | "Hello;World" |  |
| Delimiter | The delimiter to use.   If empty, we auto detect it. | ";" | Optional |
| Flags | Pass 1 to move first row into column names. | 1 | Optional      Added in version **14.3**. |

### Result

Returns matrix or error.

### Description

Splits CSV text.  
Plugin automatically detects if tab, comma or semicolon is used.  
Returns new matrix with all values.  
Width is defined by first row.  
  
Please call [Matrix.Release](MatrixRelease.md) later to free the matrix object.  
### Examples

Test it by sparsing and putting back to CSV:

 Let (\[  
  
matrix = MBS ( "Matrix.CSVSplit"; "FirstName;LastName;City¶Joe;Miller;Las Vegas¶Bob;\\"Johnson-Meyer\\";\\"Köln\\"");  
text = MBS ("[Matrix.CSV](MatrixCSV.md)"; matrix);  
r = MBS ("[Matrix.Release](MatrixRelease.md)"; matrix)  
  
\]; text )  
Quick test with CSV file:

 Let(\[  
 text = MBS ( "[Text.ReadTextFile](TextReadTextFile.md)"; "/Users/cs/Documents/test.csv"; "utf-8");  
 matrix = MBS ( "Matrix.CSVSplit"; text; ","; 1 );  
 json = MBS ("[Matrix.JSONRecords](MatrixJSONRecords.md)"; matrix; "");  
 r = MBS ("[Matrix.Release](MatrixRelease.md)"; matrix)  
\]; json)  
### See also

- [List.CSVSplit](ListCSVSplit.md)
- [Matrix.CSV](MatrixCSV.md)
- [Matrix.JSONRecord](MatrixJSONRecord.md)
- [Matrix.JSONRecords](MatrixJSONRecords.md)
- [Matrix.Release](MatrixRelease.md)
- [Matrix.SearchAndReplace](MatrixSearchAndReplace.md)
- [Matrix.SetColumnNames](MatrixSetColumnNames.md)
- [Matrix.SwapColumns](MatrixSwapColumns.md)
- [Matrix.SwapRows](MatrixSwapRows.md)
- [Text.ReadTextFile](TextReadTextFile.md)

### Release notes

- **Version 14.3**
    - Added header row flag for [Matrix.CSVSplit](https://www.mbsplugins.eu/MatrixCSVSplit.shtml) to put first row into column names.
    - Changed [Matrix.CSVSplit](https://www.mbsplugins.eu/MatrixCSVSplit.shtml) to handle CSV with multi line values better.
- **Version 12.4**
    - Fixed a problem with [List.CSVSplit](https://www.mbsplugins.eu/ListCSVSplit.shtml), [Matrix.CSVSplit](https://www.mbsplugins.eu/MatrixCSVSplit.shtml) and [QuickList.CSVSplit](https://www.mbsplugins.eu/QuickListCSVSplit.shtml) not parsing properly quoted multi line value.
- **Version 12.2**
    - Optimized [List.CSVSplit](https://www.mbsplugins.eu/ListCSVSplit.shtml), [QuickList.CSVSplit](https://www.mbsplugins.eu/QuickListCSVSplit.shtml) and [Matrix.CSVSplit](https://www.mbsplugins.eu/MatrixCSVSplit.shtml) to better handle lonely quotes in quoted strings.
- **Version 10.5**
    - Added [Matrix.CSVSplit](https://www.mbsplugins.eu/MatrixCSVSplit.shtml) function.

### Blog Entries

- [MBS FileMaker Plugin, version 14.3pr3](https://www.mbsplugins.de/archive/2024-06-14/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 14.3pr2](https://www.mbsplugins.de/archive/2024-06-10/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [CSV in FileMaker with MBS FileMaker Plugin](https://www.mbsplugins.de/archive/2022-10-11/CSV_in_FileMaker_with_MBS_File/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 12.4pr1](https://www.mbsplugins.de/archive/2022-08-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 12.2pr1](https://www.mbsplugins.de/archive/2022-04-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [New in MBS FileMaker Plugin 10.5](https://www.mbsplugins.de/archive/2020-11-23/New_in_MBS_FileMaker_Plugin_10/monkeybreadsoftware_blog_filemaker)
- [Import CSV with Matrix functions](https://www.mbsplugins.de/archive/2020-11-20/Import_CSV_with_Matrix_functio/monkeybreadsoftware_blog_filemaker)
- [Neues MBS FileMaker Plugin 10.5 - Über 6400 Funktionen in einem Plugin](https://www.mbsplugins.de/archive/2020-11-17/Neues_MBS_FileMaker_Plugin_105/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 10.5 - More than 6400 Functions In One Plugin](https://www.mbsplugins.de/archive/2020-11-17/MBS_FileMaker_Plugin_105_-_Mor/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.5pr4](https://www.mbsplugins.de/archive/2020-10-13/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 6/2020, Seite 24](https://filemaker-magazin.de/neuigkeit/4118-Appetithappen-FMM_202006)

This function is free to use.

Created 11st October 2020 , last changed 7th June 2024

  
[Matrix.CSV](MatrixCSV.md) - [Matrix.Clear](MatrixClear.md)

[HTML Version](MatrixCSVSplit.shtml)