You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-4Lines changed: 10 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,16 @@
6
6
7
7
VBA CSV interface is a class module developed to accomplish the data exchange task between VBA arrays and CSV files at high speed. Projects from [@sdkn104](https://github.com/sdkn104/VBA-CSV) and [@Senipah](https://github.com/Senipah/VBA-Better-Array), both on Github, were used for comparative performance purposes.
8
8
9
-
The parser is compatible with those CSV files compliant with the RFC-4180 specs, but add some useful features like:
10
-
* In-line comments (with a user-defined character). See [Papa Parse](https://www.papaparse.com/) project.
11
-
* Skip blanks lines and empty ones.
12
-
* User-defined escape character (option not available in _Power Query for Excel 2019_ and with some inconsistences when use the _From Text(Legacy)_ wizard)[[1]](#1).
9
+
## Advantages
10
+
* Writes and reads files at high speed.
11
+
* Supports those CSV's that follows the RFC-4180 specs.
* Auto exclude any quote mark when data is imported.
14
+
* Allows an user-defined escape token (option not available in _Power Query for Excel 2019_ and with some inconsistences when user launch the _From Text(Legacy)_ wizard)[[1]](#1).
15
+
* Supports One-dimensional arrays, Two-dimensional arrays and [jagged arrays](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/arrays/jagged-arrays).
16
+
* User has the option to import only certain range of records from given file.
17
+
* Supports in-line comments (with a user-defined character). See [Papa Parse](https://www.papaparse.com/) project.
18
+
* Supports blanks lines and empty ones.
13
19
14
20
<aid="1">[1]</a>
15
21
Power Query, and its legacy counterpart, was not able to handle fields’ embedded line breaks when the CSV's "Text qualifier" is a Single Quote or the Apostrophe char.
Provides a list of constants for use to configure the char used as escape one.
12
+
{: .fs-6 .fw-300 }
13
+
14
+
---
15
+
16
+
## Parts
17
+
18
+
|**_Constant_**|**_Member name_**|
19
+
|:----------|:----------|
20
+
|0|*NullChar*|
21
+
|1|*Apostrophe*|
22
+
|2|*DoubleQuotes*|
23
+
24
+
---
25
+
26
+
## Syntax
27
+
28
+
*variable* = `EscapeTokens`.*Constant*
29
+
30
+
>📝**Note**
31
+
>{: .text-grey-lt-000 .bg-green-000 }
32
+
>The `EscapeTokens.NullChar` value is used with the`QuotationMode.All` setting to indicates the CSV/TSV file does not use any escape char in its whole length. This values combination conduces the file to be parse/write assuming the `FieldsDelimiter` property is enough for the import/export operations.
33
+
>
34
+
>In the case the `FieldsDelimiter` property is not enough for successfully done the import/export operations, the `EscapeTokens.DoubleQuotes` value would be used for parse/write an CSV/TSV having fields to be escaped with double quote and the `EscapeTokens.Apostrophe` values for parse/write a file having fields to be escaped with the apostrophe, using the `QuotationMode.Critical` mode.
Copy file name to clipboardExpand all lines: docs/api/enumerations/quotationmode.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ nav_order: 2
8
8
# QuotationMode Enum
9
9
{: .fs-9 }
10
10
11
-
Provides a list of constants to configure the CSV parsing/writing operation behavior.
11
+
Provides a list of constants to configure the CSV/TSV parsing/writing operation behavior.
12
12
{: .fs-6 .fw-300 }
13
13
14
14
---
@@ -28,10 +28,10 @@ Provides a list of constants to configure the CSV parsing/writing operation beha
28
28
29
29
>📝**Note**
30
30
>{: .text-grey-lt-000 .bg-green-000 }
31
-
>The `QuotationMode.Critical` value, default one, is used to indicates the CSV file must use escape char only in fields having special char. The `QuotationMode.All` value most be used for those CSV files in wich all its fields will be escaped with the escape char given with the `EscapeChar` property.
31
+
>The `QuotationMode.Critical` value, default one, is used to indicates the file must use escape char only in fields having special char. The `QuotationMode.All` value most be used for those files in wich all its fields will be escaped with the escape char given with the `EscapeToken` property.
Copy file name to clipboardExpand all lines: docs/api/methods/dumptoarray.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,11 +39,11 @@ See also
39
39
40
40
The `DumpToArray` method makes a copy of all the data stored in the current instance. The data is returned in the *OutPutArray* parameter for avoid additional data copies in the internals.
41
41
42
-
The dumped data will be successively erased from memory, in other words, the current instance will doesn't hold the read CSV data any more. In the same way, the `DumpToArray` method doesn’t perform any modifications to the *OutPutArray* array for subsequent calls not preceded by one `ImportFromCSV` or `ImportFromCSVstring` method call.
42
+
The dumped data will be successively erased from memory, in other words, the current instance will doesn't hold the read CSV/TSV data any more. In the same way, the `DumpToArray` method doesn’t perform any modifications to the *OutPutArray* array for subsequent calls not preceded by one `ImportFromCSV` or `ImportFromCSVstring` method call.
43
43
44
44
>⚠️**Caution**
45
45
>{: .text-grey-lt-000 .bg-green-000 }
46
-
>The data is always returned in a Two-dimensional array, even when the imported CSV file only contain a field per record.
46
+
>The data is always returned in a Two-dimensional array, even when the imported file only contain a field per record.
47
47
{: .text-grey-dk-300 .bg-yellow-000 }
48
48
49
49
[Back to Methods overview](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/)
Copy file name to clipboardExpand all lines: docs/api/methods/dumptojaggedarray.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ See also
42
42
43
43
The `DumpToJaggedArray` method makes a copy of all the data stored in the current instance. The data is returned in the *OutPutArray* parameter for avoid additional data copies in the internals.
44
44
45
-
The dumped data will be successively erased from memory, in other words, the current instance will doesn't hold the read CSV data any more. In the same way, the `DumpToJaggedArray` method doesn’t perform any modifications to the *OutPutArray* array for subsequent calls not preceded by one `ImportFromCSV` or `ImportFromCSVstring` method call.
45
+
The dumped data will be successively erased from memory, in other words, the current instance will doesn't hold the read CSV/TSV data any more. In the same way, the `DumpToJaggedArray` method doesn’t perform any modifications to the *OutPutArray* array for subsequent calls not preceded by one `ImportFromCSV` or `ImportFromCSVstring` method call.
Copy file name to clipboardExpand all lines: docs/api/methods/dumptosheet.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,5 +60,5 @@ See also
60
60
61
61
When the *WBookName* parameter is omitted the data is dumped into the Workbook that holds the CSV interface's *VBAProject*. Omitting the *SheetName* parameter adds a new Worksheet to the desired Workbook. Also, if the *RngName* parameter is omitted the data will dumped starting on the "A1" named cell in the desired Worksheet.
62
62
63
-
The dumped data will be successively erased from memory, in other words, the current instance will doesn't hold the read CSV data any more. In the same way, the `DumpToSheet` method doesn’t perform any action for subsequent calls not preceded by one `ImportFromCSV` or `ImportFromCSVstring` method call.
63
+
The dumped data will be successively erased from memory, in other words, the current instance will doesn't hold the read CSV/TSV data any more. In the same way, the `DumpToSheet` method doesn’t perform any action for subsequent calls not preceded by one `ImportFromCSV` or `ImportFromCSVstring` method call.
64
64
[Back to Methods overview](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/)
Copy file name to clipboardExpand all lines: docs/api/methods/exporttocsv.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ nav_order: 5
8
8
# ExportToCSV
9
9
{: .fs-9 }
10
10
11
-
Exports an array's content to a CSV file.
11
+
Exports an array's content to a CSV/TSV file.
12
12
{: .fs-6 .fw-300 }
13
13
14
14
---
@@ -44,16 +44,16 @@ _None_
44
44
45
45
>📝**Note**
46
46
>{: .text-grey-lt-000 .bg-green-000 }
47
-
>Before invoke the `ExportToCSV` method, the user must to open a connection to the CSV file. Passing a variable that isn't an array will cause an error and the operation aborts.
47
+
>Before invoke the `ExportToCSV` method, the user must to open a connection to the file. Passing a variable that isn't an array will cause an error and the operation aborts.
Copy file name to clipboardExpand all lines: docs/api/methods/getdatafromcsv.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ nav_order: 6
8
8
# GetDataFromCSV
9
9
{: .fs-9 }
10
10
11
-
Dumps a CSV file content to a string variable
11
+
Dumps a CSV/TSV file content to a string variable
12
12
{: .fs-6 .fw-300 }
13
13
14
14
---
@@ -27,7 +27,7 @@ The required *csvPathAndFilename* argument is an identifier specifying a `String
27
27
28
28
>📝**Note**
29
29
>{: .text-grey-lt-000 .bg-green-000 }
30
-
>The *csvPathAndFilename* parameter must be the full path to the target CSV file, this means, the parameter holds the folder path, the file name and the ".csv" extension.
30
+
>The *csvPathAndFilename* parameter must be the full path to the target file, this means, the parameter holds the folder path, the file name and the extension.
Copy file name to clipboardExpand all lines: docs/api/methods/importfromcsv.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ nav_order: 7
8
8
# ImportFromCSV
9
9
{: .fs-9 }
10
10
11
-
Imports a CSV file's content to the current instance.
11
+
Imports a CSV/TSV file's content to the current instance.
12
12
{: .fs-6 .fw-300 }
13
13
14
14
---
@@ -44,22 +44,22 @@ _None_
44
44
45
45
>📝**Note**
46
46
>{: .text-grey-lt-000 .bg-green-000 }
47
-
>If the *HeadersOmission* parameter is set to `True`, the CSV file headers, first record, will be ignored by the parser only when the `StartingRecord` property is set to 1.
47
+
>If the *HeadersOmission* parameter is set to `True`, the file headers, first record, will be ignored by the parser only when the `StartingRecord` property is set to 1.
48
48
>The *PassControlToOS* parameter allows user to pass control to the operating system. Control is returned after the operating system has finished processing the events in its queue.
User can set `CommentLineIndicator` property for those CSV files having a combination of empties lines, blanks lines or commented ones for parse the file ONLY when the parser is working on `QuotationMode.Critical` mode. In that mode, the cited lines are simply skipped, leaving no empty values between records separated by this kind of lines. In other words, if the CSV file holds a record and then some special lines (blank, empty or commented) and then another record, the second record will be saved contiguous to the first record ignoring the lines between both.
58
+
User can set `CommentsToken` property for those files having a combination of empties lines, blanks lines or commented ones for parse the file ONLY when the parser is working on `QuotationMode.Critical` mode. In that mode, the cited lines are simply skipped, leaving no empty values between records separated by this kind of lines. In other words, if the file holds a record and then some special lines (blank, empty or commented) and then another record, the second record will be saved contiguous to the first record ignoring the lines between both.
59
59
60
60
>⚠️**Caution**
61
61
>{: .text-grey-lt-000 .bg-green-000 }
62
-
>Before invoke the `ImportFromCSV` method, the user must to open a connection to the CSV file. If the CSV file has no data, this is the file is an empty one, the `ImportFromCSV` method returns an empty array, that is, an array bounded from 0 to -1 and holding no elements and no data.
62
+
>Before invoke the `ImportFromCSV` method, the user must to open a connection to the file. If the target file has no data (the file is an empty one) the `ImportFromCSV` method returns an empty array, that is, an array bounded from 0 to -1 and holding no elements and no data.
63
63
{: .text-grey-dk-300 .bg-yellow-000 }
64
64
65
65
[Back to Methods overview](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/)
0 commit comments