Skip to content

Commit b80e1d3

Browse files
authored
Update README.md
1 parent d007945 commit b80e1d3

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# VBA-CSV file Manager
1+
# VBA-CSV interface
22
[![version](https://img.shields.io/static/v1?label=version&message=v1.0.1&color=brightgreen&style=plastic)](https://github.com/ws-garcia/VBA-CSV-interface/releases/tag/v1.0.1)
33
[![version](https://img.shields.io/static/v1?label=licence&message=GPL&color=informational&style=plastic)](https://www.gnu.org/licenses/)
44
## Table of contents
@@ -13,11 +13,11 @@
1313
The CSV, stands from Comma Separated Values, files are special kind of tabulated plain text data widely used in data exchange. There is no globally accepted standard format for that kind of files, however, out there are well formed standards such as [RFC4180](https://www.ietf.org/rfc/rfc4180.txt) proposed by The Internet Society.
1414
Although many solutions has been developed for work with CSV files into VBA, including projects from [@sdkn104](https://github.com/sdkn104/VBA-CSV) and [@Senipah](https://github.com/Senipah/VBA-Better-Array) on Github, the vast majority of these have serious performance lacks. This argumentations conduce to the development of a VBA class module that allows users exchange data between VBA arrays and CSV files at relatively high speed.
1515
### Advantages
16-
* CSVfileManager can work with like RFC4180 CSV standard (there are few differences).
16+
* CSVinterface can work with like RFC4180 CSV standard (there are few differences).
1717
* User have the option to import only certain range of records from given CSV file.
1818
* Writes and reads files at high speed.
1919
## Philosophy
20-
The VBA CSVfileManager class module is designed for gain advantage from the well structured CSV files, this means, there isn't automatic syntax check, given the user decide how the class will works. This can be seen as a weakness, but the class get a speed-up on writing and reading procedures at time the user controls how the file is interpreted, keeping in mind that, in fact, VBA is a language with slow code execution speed.
20+
The VBA CSVinterface class module is designed for gain advantage from the well structured CSV files, this means, there isn't automatic syntax check, given the user decide how the class will works. This can be seen as a weakness, but the class get a speed-up on writing and reading procedures at time the user controls how the file is interpreted, keeping in mind that, in fact, VBA is a language with slow code execution speed.
2121
Under this idealization it's easy to develop a solution that implicity complies with the RFC4180 standart for user specified CSV document format. In order to achieve this, the user must to follow the rules specified below.
2222
## Rules
2323
1. Each record is located on a separate line, delimited by a line break (CRLF, CR, LF).
@@ -29,36 +29,36 @@ Under this idealization it's easy to develop a solution that implicity complies
2929
## Usage
3030
Import whole CSV file into an VBA array
3131
```vbscript
32-
Dim CSVmanager As CSVfileManager
32+
Dim CSVix As CSVinterface
3333
Dim MyArray As variant
34-
Set CSVmanager = New CSVfileManager
35-
Call CSVmanager.OpenConnection(fileName)
36-
Call CSVmanager.ImportFromCSV
37-
MyArray = CSVmanager .CSVdata
38-
Set CSVmanager = Nothing
34+
Set CSVix = New CSVinterface
35+
Call CSVix.OpenConnection(fileName)
36+
Call CSVix.ImportFromCSV
37+
MyArray = CSVix .CSVdata
38+
Set CSVix = Nothing
3939
```
4040
Import a range of records from CSV file into a VBA array
4141
```vbscript
42-
Dim CSVmanager As CSVfileManager
42+
Dim CSVix As CSVinterface
4343
Dim MyArray As variant
44-
Set CSVmanager = New CSVfileManager
45-
CSVmanager.StartingRecord = 10
46-
CSVmanager.EndingRecord = 20
47-
Call CSVmanager.OpenConnection(fileName)
48-
Call CSVmanager.ImportFromCSV
49-
MyArray = CSVmanager .CSVdata
50-
Set CSVmanager = Nothing
44+
Set CSVix = New CSVinterface
45+
CSVix.StartingRecord = 10
46+
CSVix.EndingRecord = 20
47+
Call CSVix.OpenConnection(fileName)
48+
Call CSVix.ImportFromCSV
49+
MyArray = CSVix .CSVdata
50+
Set CSVix = Nothing
5151
```
5252
Set the char to encapsulate, coerce, fields
5353
```vbscript
54-
CSVmanager.EscapeChar = NotEscape
55-
CSVmanager.EscapeChar = Apostrophe
56-
CSVmanager.EscapeChar = DoubleQuotes
54+
CSVix.EscapeChar = NullChar
55+
CSVix.EscapeChar = Apostrophe
56+
CSVix.EscapeChar = DoubleQuotes
5757
```
5858
Set fields and records delimiters
5959
```vbscript
60-
CSVmanager.FieldsDelimiter = ";"
61-
CSVmanager.RecordsDelimiter = vbCrLf
60+
CSVix.FieldsDelimiter = ";"
61+
CSVix.RecordsDelimiter = vbCrLf
6262
```
6363
## Benchmark
6464
The class was tested against many solutions using the oldest, lowest-processing capacity laptop I could find: Win 7 Starter 32-bit, Intel® Atom™ CPU N2600 @1.60 GHz, 1 GB RAM.
@@ -72,7 +72,7 @@ The times showed, seconds, in the bellow table are the average of ten (10) calls
7272
|*ArrayFromCSV (Heffernan)*|0.2396|1.7839|2.2057|22.385|
7373
|*FromCSV(@Senipah)*|0.3594|3.8333|16.6172|>1,000|
7474

75-
Considering the system specification for the test machine (4 MB/sec. when it writes files to an USB), the above times was stunning!: up to 2.69 MB/sec. for reading operations.
75+
Considering the system specification for the test machine (4 MB/sec. when it writes files to an USB), the above times was stunning!: up to 2.75 MB/sec. for reading operations.
7676
## Licence
7777
Copyright (C) 2020 [W. García](https://github.com/ws-garcia/VBA-CSV-interface/).
7878

0 commit comments

Comments
 (0)