Csv reader
gridgulp.readers.csv_reader ¶
CSV file reader with intelligent parsing and encoding detection.
CSVReader ¶
Bases: SyncBaseReader
Reader for CSV and TSV files with intelligent parsing.
Initialize CSV reader.
Parameters:
-
file_path(Path) –Path to CSV file
-
file_info(FileInfo) –File information
Source code in src/gridgulp/readers/csv_reader.py
can_read ¶
Check if can read CSV files.
Returns¶
bool True if the file type is CSV or TSV; False otherwise.
Notes¶
This method validates that the CSVReader can handle the given file type. Text files (.txt) are handled by TextReader instead, even if they contain delimited data.
Source code in src/gridgulp/readers/csv_reader.py
get_supported_formats ¶
Get supported CSV formats.
Returns¶
list[str] List of supported file extensions: ["csv", "tsv", "txt"].
Notes¶
While this method returns "txt" as supported, the actual can_read() method only accepts CSV and TSV file types. Text files are included here for completeness but are typically handled by TextReader.
Source code in src/gridgulp/readers/csv_reader.py
read_sync ¶
Read CSV file synchronously.
Returns:
-
FileData–FileData with single sheet containing CSV data
Raises:
-
ReaderError–If file cannot be read