Package core.helpers.csvHelper
Class CsvHelper
java.lang.Object
core.helpers.csvHelper.CsvHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadds row to csv file file path: csv.path + csv.csvFile using csvObject eg.voidgetAllCsvData(String filePath) gets all csv data in list of string arraysgetAllCsvData(String filePath, int startingRow, boolean skipEmptyRows) gets all csv data in list of string arraysgetAllCsvData(String filePath, CsvObject csv) gets all csv data in list of string arraysgetAllCsvDataFirstRowAsHeader(String filePath) gets all csv data files skipping first row as headergetCellData(CsvObject csv) gets single cell data in csv fileintgetColumnIndex(String column, String filePath) get column index by column valueintgetRowIndex(String id, String filePath) get row index in csv file that equal id valuevoidwriteNewCsv(CsvObject csv) file path: csv.path + csv.csvFile using csvObjectvoidwriteToCell(CsvObject csv, String value) update cell based on row and column.voidwriteToCell(CsvObject csv, String value, String csvPath) update cell based on row and column.
-
Constructor Details
-
CsvHelper
public CsvHelper()
-
-
Method Details
-
getCellData
gets single cell data in csv file- Parameters:
csv- - requires. csv.row, csv.column, csv.csvFile- Returns:
- Throws:
Exception
-
getAllCsvData
gets all csv data in list of string arrays- Parameters:
csv- - requires. csv.csvFile- Returns:
- Throws:
Exception
-
getAllCsvData
gets all csv data in list of string arrays- Parameters:
csv- - requires. csv.csvFile- Returns:
- Throws:
Exception
-
getAllCsvData
gets all csv data in list of string arrays- Parameters:
csv- - requires. csv.csvFile- Returns:
- Throws:
Exception
-
getAllCsvDataFirstRowAsHeader
gets all csv data files skipping first row as header- Parameters:
filePath-- Returns:
-
writeNewCsv
file path: csv.path + csv.csvFile using csvObject- Parameters:
csv- - required: csv.csvFile, csv.value value: String [] record = "3,David,Feezor,USA,40".split(",");- Throws:
Exception
-
AddRow
adds row to csv file file path: csv.path + csv.csvFile using csvObject eg. csv.value: String [] record = "3,David,Feezor,USA,40".split(",");- Parameters:
csv-- Throws:
Exception
-
writeToCell
update cell based on row and column. csv object must containe filename, row and column- Parameters:
csv- csv file to updatevalue- value to write
-
writeToCell
update cell based on row and column. csv object must contain filename, row and column- Parameters:
csv- csv file to updatevalue- value to writecsvPath- path to the csv data relative to root directory
-
appendCsv
- Parameters:
csv- - required: csv.csvFile, csv.value value: String [] record = "3,David,Feezor,USA,40".split(",");- Throws:
Exception
-
getRowIndex
get row index in csv file that equal id value- Parameters:
id-filePath-- Returns:
-
getColumnIndex
get column index by column value- Parameters:
column-filePath-- Returns:
-