6-23
k
CSV Access Commands
CSV access commands provide a means to directly load data into a program from a CSV file
in storage memory or on an SD card.
• For sake of simplicity, the explanations in this section use numbers (1, 2, 3, etc.) for rows
and letters (A, B, C, etc.) for columns. For example, the cell in the upper left corner of
any CSV file (the first cell in the file) is Cell A1. The cell in the lower right corner of a 3
×
3
CSV file would be Cell C3.
• The term “next cell” is used to refer to the cell immediately to the right of the current
cell. If the current cell is at the end of a row (the rightmost cell), the “next cell” is the first
(leftmost) cell in the row below it.
The table below shows the six CSV access codes.
Command
Overview
CSVInfo
Gets the row count and column count of a CSV file and outputs the
result in list format.
OpenCSV
Opens a CSV file.
CloseCSV
Closes the currently open CSV file.
LoadNextCell
Loading of CSV file data with CSV access commands is always
performed in cell units. The first execution of the LoadNextCell
command following the OpenCSV command makes the first cell of
the file the load target cell. After that, each subsequent execution will
sequentially switch the load target cell to the next cell. Each execution
of this command gets the attribute data of the load target cell and
outputs it in list format.
GetCellValue
Gets the data in the current load target cell and outputs it as a value.
GetCellString
Gets the data in the current load target cell and outputs it as a text
string.
The rough flow for a program would be as shown below.
OpenCSV: To open the CSV file
LoadNextCell: To specify the load target cell
GetCellValue; GetCellString: To get the cell data
CloseCSV: To close the CSV file
CSV File Handling Precautions
Note the following precautions whenever handling CSV files with CSV access commands.
• Specification of a comma (,) or semicolon (;) as the delimiter symbol, and a period (.)
or comma (,) as the decimal point symbol is in accordance with the calculator’s “CSV
Separator” and “CSV Decimal Symbol” setting. For details, refer to “Specifying the CSV File
Delimiter Symbol and Decimal Point” (page 4-15).
• CR, LF, and CRLF in a CSV file are all recognized as line feed codes.
• Single spaces and tab operations at the beginning of rows, before or after delimiter symbols,
and before line feeds, and multiple spaces and tabs in a CSV file are ignored.