Solution
To optimize reading speed and avoid loading the entire CSV file, we can use the start of read offset parameter in the Read Delimited Spreadsheet.vi. This allows us to begin reading at a specific byte position in the file, so only the required portion is processed. This method significantly reduces read time for large files.


1. File Opening and Size Calculation
2. Offset Calculation
-
The user provides a Percentage % value (0–100).
-
The VI divides this value by 100 to get a fractional percentage.
-
It multiplies the file’s total size by this fraction to compute the Offset size (in bytes)—the starting point for reading.
3. Reading Data
-
The VI calls the Read Delimited Spreadsheet (string) sub VI.
-
It passes the calculated offset, the number of rows to read (number of rows (all: -1)), and the file path.
-
The sub VI reads the specified number of rows starting from the offset.
4. Output
-
All rows return the data read from the file.
-
EOF indicates if the end of the file was reached during the read.
-
Total size (in bytes) and Offset size (in bytes) provide file metrics.
Image below shows the accuracy of the VI when the percentage is set as 0 (obtain data from the very beginning of the file) and number of rows is set as 5 (obtain only 5 rows of data from the starting row).
