Next
Update
Prev
Import
Scan Record
Change History
Change History (XML)

This sample demonstrates how to modify data while importing the CSV (XLS, XLSX) file using the parsing function (parseFunction).

If you set the parseFunction attribute in the excelCSVImport function, the parsing function will check each record and modify if it needs to be changed while importing the CSV file. This sample checks the fifth field and remove "-".

function excelCSVImport() {
  var option = {
    layoutChangeOption:0,
    parseFunction:csvParse
  };

  gridRoot.excelCSVImport(0, "http://www.koolchart.com/koolgrid/server/importCSV.php");
}

function csvParse(parsedObj, csvStr, rowIndex) {
  if (parsedObj.F4)
    if (typeof parsedObj.F4 == "string" && parsedObj.F4.indexOf("-"))
      parsedObj.F4 = parsedObj.F4.replace("-", "");
      
   return parsedObj;
}
layoutChangeOption layout change options - 0 : ask to the user, 1 : import data in the current layout, 2 : import data by reconfiguring the layout
parseFunction It sets the name of the parsing function.

© 2017 KoolChart. All rights reserved.