Class CsvSpreadsheet
#include <CsvSpreadsheet.h >
A class to read a CSV file and peform spreadsheet manipulations on it.
A cell address is a string comprised of a column followed by a row, e.g. D20.
Columns are alphabetically identified: A..Z, AA..AZ, BA..BZ, etc. AAA..AAZ, ABA..ABZ, ...
Row are always positive integers. 0 is an invalid row.
A range is a cell address followed by ".." followed by another cell address.
In a range, left-right and up-down order is not required.
string filename |
a path in the file system where the CSV file can be found. The file does not request the .csv extension as long as it is in CSV format. Default value: "" |
Instantiate this class - start by reading first line of CSV db
to get the list of fields. Note that header case does not matter
for searches, but results are always returned using the header case
from the CSV file, regardless of field case in the query.
Return value: (an instance of this class).
string filename |
string newName |
int offsetRow |
Default value: 0 |
int offsetColumn |
Default value: 0 |
FILE* fh |
|
int offsetRow |
Default value: 0 |
int offsetColumn |
Default value: 0 |
FILE* fh |
string& content |
Call after instantiating to ensure this is a valid CSV db.
Return value: true if CSV file found and with the correct format; false if CSV file not found or incorrect format
int count |
int column |
int column |
string column |
int row |
|
int column |
row from 1+, column from 1+
int row1 |
|
int column1 |
|
int row2 |
|
int column2 |
string address |
int count |
int row |
string address |
string address |
|
int& row |
|
int& column |
string address |
|
int& row1 |
|
int& column1 |
|
int& row2 |
|
int& column2 |
int row |
|
int column |
|
string value |
int row |
|
string column |
|
string value |
string address |
|
string value |
int row |
|
int column |
|
int value |
int row |
|
string column |
|
int value |
string address |
|
int value |
int row |
|
int column |
|
float value |
int row |
|
string column |
|
float value |
string address |
|
float value |
int row |
|
int column |
row from 1+, column from 1+
int row |
|
string column |
string address |
int row |
|
int column |
int row |
|
string column |
string address |
int row |
|
int column |
int row |
|
string column |
string address |
int row |
|
int startColumn |
Default value: 0 |
int stopColumn |
Default value: 0 |
int column |
|
int startRow |
Default value: 0 |
int stopRow |
Default value: 0 |
string column |
|
int startRow |
Default value: 0 |
int stopRow |
Default value: 0 |
string range |
string range |
string range |
string value |
|
int startRow |
|
int startColumn |
|
int stopRow |
|
int stopColumn |
string value |
|
string startRange |
|
string stopRange |
Default value: "" |
string value |
|
int row |
|
int startColumn |
|
int stopColumn |
string value |
|
int startRow |
|
int stopRow |
|
int column |
string value |
|
int startRow |
|
int startColumn |
|
int stopRow |
|
int stopColumn |
string value |
|
string startRange |
|
string stopRange |
Default value: "" |
int rowNubmer |
Add another row to the spreadsheet. The new row will have the row number provided.
@param rowNumber - the new row number to create
Return value: true if successful
int column |
the new position to create, where A is 1, B is 2, etc. |
Add another column to the spreadsheet. The new column will have the column position provided.
Return value: true if successful
string column |
the new column letter to create, e.g. A, B, C, etc. |
Add another column to the spreadsheet. The new column will have the column letter provided.
Return value: true if successful
int rowNumber |
int column |
string column |
const HashArray& row |
a db row as returned by findRecord(). |
FILE* outf |
Default value: stdout |
Debugging utility - output a single row from the database
Return value: An HTML table for a single row of data.
char sep |
FILE* f |
|
int startOffset |
Default value: 1 |
char separator |
Default value: ' |
FILE* f |
|
const HashArray& fields |
|
char separator |
Default value: ' |
string csvfilename |
Filename of loaded spreadsheet |
string name |
spreadsheet name (optional) |
char separator |
Delimiter for file I/O. Default: comma |
bool ssLoaded |
Flag: spreadsheet has been loaded from a file |
int columnCount |
Size of spreadsheet |
int rowCount |
Size of spreadsheet |
vector <HashArray > data |
Contents of spreadsheet |
string& text |
|
FILE* fh |
|
int lastpos |
|
char separator |
Supports fgetcsv()