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
+22-17Lines changed: 22 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
6
6
## Introductory words
7
7
8
-
The most powerful and comprehensive CSV/[TSV](https://www.iana.org/assignments/media-types/text/tab-separated-values)/[DSV](https://www.linuxtopia.org/online_books/programming_books/art_of_unix_programming/ch05s02.html) data management library for VBA, providing parsing/writing capabilities compliant with RFC-4180 specifications and a complete set of tools for manipulating records and fields: [dedupe](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/dedupe.html), [sort](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/sort.html) and [filter](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/filter.html) records; [rearrange](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/rearrangefields.html), [shift](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/shiftfield.html), [merge](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/mergefields.html) and [split](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/splitfield.html) fields; and much more!
8
+
The most powerful and comprehensive CSV/[TSV](https://www.iana.org/assignments/media-types/text/tab-separated-values)/[DSV](https://www.linuxtopia.org/online_books/programming_books/art_of_unix_programming/ch05s02.html) data management library for VBA, providing parsing/writing capabilities compliant with RFC-4180 specifications and a complete set of tools for manipulating records and fields: [dedupe](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/dedupe.html), [sort](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/sort.html) and [filter](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/filter.html) records; [rearrange](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/rearrangefields.html), [shift](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/shiftfield.html), [merge](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/mergefields.html) and [split](https://ws-garcia.github.io/VBA-CSV-interface/api/methods/splitfield.html) fields. Is your data spread over two or more CSV files? Don't worry, here you will find [Left, Right and Inner](https://ws-garcia.github.io/VBA-CSV-interface/api/csvarraylist.html) joins, and much more!
9
9
10
10
## Advantages
11
11
*__RFC-4180 specs compliant__.
@@ -343,25 +343,30 @@ Sub DelimitersGuessing()
343
343
End Sub
344
344
```
345
345
346
-
With a CSV file parser you can do many things, for example, an user can parse the contents of the Windows clipboard and dump it to an Excel Worksheet with a procedure like the following (thanks to @OlimilO1402[for the `CBGetText` function code](https://github.com/OlimilO1402/XL_ClipboardReader/blob/main/Modules/MClipboard.bas)):
346
+
With VBA CSV interface, many things can be done, for example, an user can perform like SQL joins such as:
347
347
348
348
```
349
-
Sub ImportFromClipBoard()
350
-
Dim CSVint As CSVinterface
351
-
Dim CSVstring As String
352
-
Dim SPACE_CHR As String
349
+
Sub JoinTwoTables()
350
+
Dim WB As Workbook
351
+
Dim WS As Worksheet
352
+
Dim t1 As CSVArrayList
353
+
Dim t2 As CSVArrayList
354
+
Dim arrT1() As Variant
355
+
Dim arrT2() As Variant
356
+
Dim rTable As CSVArrayList
353
357
354
-
SPACE_CHR = " "
355
-
CSVstring = Join$(Split(CBGetText, SPACE_CHR), vbTab) ' Replace all space char with Tab char
Copy file name to clipboardExpand all lines: docs/api/csvarraylist.md
+72-5Lines changed: 72 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,12 +5,9 @@ nav_order: 5
5
5
---
6
6
7
7
# CSVArrayList
8
-
{: .d-inline-block }
8
+
{: .fs-6 }
9
9
10
-
New
11
-
{: .label .label-purple }
12
-
13
-
Class module developed to emulate some functionalities from the `ArrayList` present in some most modern languages. The `CSVArrayList` serve as a container for all the data read from CSV files and can be used to manipulate the stored items, or to store data that does not come from a CSV file, according to the user's request.
10
+
Class module developed to emulate some functionalities from the `ArrayList` present in some most modern languages. The `CSVArrayList` serves as a container for all the data read from CSV files and can be used to manipulate the stored items, or to store data that does not come from a CSV file, according to the user's request.
14
11
{: .fs-4 .fw-300 }
15
12
16
13
---
@@ -37,6 +34,11 @@ Class module developed to emulate some functionalities from the `ArrayList` pres
37
34
<tdstyle="text-align: left;">Appends a copy of the specified values to the current instance. In contrast to the <code>Add</code> method, the data is operated on before being stored, so if the values to be appended to the current instance are not one-dimensional arrays, they will be properly stored as one-dimensional array. In this way, the user will be able to use the data sorting methods provided by the class as long as no multi-dimensional arrays are stored in the current instance.</td>
<tdstyle="text-align: left;">Appends a copy of the specified values to the current instance using a string-type key. This allows access to the elements by providing an index or a key. If the key exist, the item will be modified only if the <code>UpdateExistingItems</code> parameter is ser to <code>True</code>.</td>
<tdstyle="text-align: left;">Indicates whether the current instance is used to store indexed elements.</td>
105
+
</tr>
106
+
<tr>
107
+
<tdstyle="text-align: left; color:blue;"><em>Inner, Left and Right Join</em></td>
108
+
<tdstyle="text-align: left;">Method</td>
109
+
<tdstyle="text-align: left;">Run a like SQL join on the provided data tables.<br>1) Use a string such as <code>{1-2,5,ID};{1-6}</code> as a predicate of the columns to indicate the join of columns 1 to 2, 5 and ID of leftTable with the columns 1 to 6 of rightTable.<br>2) Use a string such as <code>{*};{1-3}</code> to indicate the union of ALL columns of leftTable with columns 1 to 3 of rightTable.<br>3) The predicate must use the dot syntax <code>[t1.#][t1.fieldName]</code> to indicate the fields of the table, where t1 refers to the leftTable.<br>4) The matchKeys predicate must be given as <code>#/$;#/$</code></td>
<tdstyle="text-align: left;">Inserts an Item, at the given Index, in the current instance of the class.</td>
@@ -97,6 +124,21 @@ Class module developed to emulate some functionalities from the `ArrayList` pres
97
124
<tdstyle="text-align: left;">Gets or sets an Item, by its index, from the current instance. This is the default property, so the user can use abbreviated expressions such as <code>expression(i)</code> to access the Item <code>i</code>, where <code>expression</code> represents a <code>CSVArrayList</code> object.</td>
<tdstyle="text-align: left;">Checks if a given field exists in a record of the current instance. Returns <code>False</code> when the key can not be found.</td>
<tdstyle="text-align: left;">Gets or sets the collection of elements from or to the current instance. To set the elements, the <code>AValue</code> parameter must be an array.</td>
@@ -107,11 +149,31 @@ Class module developed to emulate some functionalities from the `ArrayList` pres
107
149
<tdstyle="text-align: left;">Turns a jagged array into a two dim array. The method will successively deconstruct and delete the jagged array, passing its contents to the specified two-dimensional array.</td>
<tdstyle="text-align: left;">Searches for an element in the internal indexed records, using a key, in the current instance (ONLY when the data is already sorted in ascending order). Returns the index of the element when found and -1 when the key is not found.</td>
<tdstyle="text-align: left;">Reduces the internal array list to the result by evaluate the <code>ReductionExpression</code> parameter over all items.</td>
<tdstyle="text-align: left;">Reinitializes the current instance of the class and reserves the storage space desired by the user through the <code>bufferSize</code> parameter.</td>
@@ -122,6 +184,11 @@ Class module developed to emulate some functionalities from the `ArrayList` pres
122
184
<tdstyle="text-align: left;">Removes the Item at specified Index.</td>
Copy file name to clipboardExpand all lines: docs/api/csvdialect.md
+1-4Lines changed: 1 addition & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,7 @@ nav_order: 6
5
5
---
6
6
7
7
# CSVdialect
8
-
{: .d-inline-block }
9
-
10
-
New
11
-
{: .label .label-purple }
8
+
{: .fs-6 }
12
9
13
10
Class module developed to share CSV dialects, or group of specific and related configuration, which instructs the parser on how to interpret the character set read from a CSV file. This container travels through the parsing and sniffer methods.
Copy file name to clipboardExpand all lines: docs/api/csvsniffer.md
+1-4Lines changed: 1 addition & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,7 @@ nav_order: 7
5
5
---
6
6
7
7
# CSVSniffer
8
-
{: .d-inline-block }
9
-
10
-
New
11
-
{: .label .label-purple }
8
+
{: .fs-6 }
12
9
13
10
Class module developed as an attempt to sniff/guess CSV dialects without user intervention. In some preliminary tests, the sniffer was 100% accurate, but there is always the risk of facing ambiguous cases that can only be solved with human intervention. This class is inspired by the [work of scientist Till Roman Döhmen](https://homepages.cwi.nl/~boncz/msc/2016-Doehmen.pdf), with some improvements to disambiguate the most complicated cases.
Copy file name to clipboardExpand all lines: docs/api/csvtextstream.md
+1-4Lines changed: 1 addition & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,7 @@ nav_order: 8
5
5
---
6
6
7
7
# CSVTextStream
8
-
{: .d-inline-block }
9
-
10
-
New
11
-
{: .label .label-purple }
8
+
{: .fs-6 }
12
9
13
10
Easy-to-use class module developed to enable I/O operations over "big" text files, at high speed, from VBA. The module hasn’t reference to any external API library and has the ability to read and write UTF-8 encoded files.
@@ -32,13 +32,21 @@ Splits the CSV data into a set of files in which each piece has a related portio
32
32
<tdstyle="text-align: left;">Required. Identifier specifying a <code>String</code> Type variable representing the full path to the target CSV file.</td>
<tdstyle="text-align: left;">Optional. Identifier specifying a <code>Long</code> Type variable representing the index of the field on which the creation of the data groups will take place.</td>
<tdstyle="text-align: left;">Optional. Identifier specifying a <code>Variant</code> Type variable representing the indexes of the fields on which the data groups will be created.</td>
<tdstyle="text-align: left;">Optional. Identifier specifying a <code>Boolean</code> Type variable indicating whether the target CSV file has a header record.</td>
<tdstyle="text-align: left;">Optional. Identifier specifying a <code>Boolean</code> Type variable indicating whether the header record, from the target CSV file, will be copied to all created files.</td>
<tdstyle="text-align: left;">Optional. Identifier specifying a <code>Long</code> Type variable representing the buffer size factor used to read the target CSV file.</td>
49
+
</tr>
42
50
</tbody>
43
51
</table>
44
52
@@ -50,11 +58,11 @@ Splits the CSV data into a set of files in which each piece has a related portio
50
58
51
59
## Behavior
52
60
53
-
The `CSVsubsetSplit` method will create a file for each different value (data grouping) in the field at the *subsetColumn* position, then all related data is appended to the respective file. Use the *headers* parameter to include a header record in each new CSV file. When the CSV file has a header record and the user sets the *header* parameter to `False`, the header row is saved in a separate file and the rest of CSV files will have no header record.
61
+
The `CSVsubsetSplit` method will create a file for each different value (data grouping) in the fields at the *subsetColumns* position, then all related data is appended to the respective file. Use the *headers* parameter to include a header record in each new CSV file. The *subsetColumns* parameter can be a single value or an array of `Long` values. When the CSV file has a header record and the user sets the *header* parameter to `False`, the header row is saved in a separate file and the rest of CSV files will have no header record. The user can control when to include the headers by using the *repeatHeaders* parameter.
54
62
55
63
>📝**Note**
56
64
>{: .text-grey-lt-000 .bg-green-000 }
57
-
>The result subsets will be saved in a folder named [\*-subsets], where (\*) denotes the name of the source CSV file.
65
+
>The result subsets will be saved in a folder named [\*-WorkDir], where (\*) denotes the name of the source CSV file.
<tdstyle="text-align: left;">Optional. Identifier specifying a <code>Boolean</code> Type variable.</td>
49
+
</tr>
46
50
</tbody>
47
51
</table>
48
52
@@ -62,7 +66,7 @@ See also
62
66
63
67
## Behavior
64
68
65
-
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.
69
+
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. Use the *BlockAutoFormat* parameter if you believe that the target CSV data may induce some sort of [injection to your machine](http://georgemauer.net/2017/10/07/csv-injection.html).
0 commit comments