|
DarrenF
Importing Data from Excel (XLS) file to HF February 26, 2009 05:41PM |
IDXLSFile is int
iNo_rows is int
glocaliIResult is int
// Open the Currencies excel file
IDXLSFile = xlsOpen("c:\My Projects\InterPoint\Extract Files for Import\currencies.xls")
// If the Excel file was found, then carry on processing
// ELSE
// Report an error
IF IDXLSFile <> -1 THEN
// Get number of rows in the Excel file
iNo_rows = xlsNbRow(IDXLSFile)
// Test for existence of Country table
IF NOT HOpen(Country,hOReadWrite) THEN
Error("Unable to locate the required Country database table!")
RETURN
END
// HCreation will delete and re-create these tables and also reset all the rec no's and auto IDs
HCreation(Country)
// Process each row of the Excel file
// Start at row 2 to ignore the Excel title row...
FOR glocaliNV_Row = 2 TO iNo_rows
// Country Details
Country.cCountryCode = xlsData(IDXLSFile,glocaliNV_Row,1)
Country.cCountryName = xlsData(IDXLSFile,glocaliNV_Row,5)
Country.cCurrencyCode = xlsData(IDXLSFile,glocaliNV_Row,2)
Country.nCurrencyCode = xlsData(IDXLSFile,glocaliNV_Row,3)
Country.cCurrencyDesc = xlsData(IDXLSFile,glocaliNV_Row,4)
Country.bActiveCountry = xlsData(IDXLSFile,glocaliNV_Row,6)
Country.bActiveCurrency = xlsData(IDXLSFile,glocaliNV_Row,7)
Country.cCurrencySymbol = ""
Country.dtCreated = DateSys + TimeSys
Country.cNotes = "Auto loaded from ISO import file on " + DateToString(DateSys())
// Write the data to the database
HAdd(Country)
END
// Close XLS file
xlsClose(IDXLSFile)
ELSE
Info(xlsMsgError(IDXLSFile))
END
|
Grand77
Re: Importing Data from Excel (XLS) file to HF November 25, 2009 12:37AM |
|
Allard
Re: Importing Data from Excel (XLS) file to HF February 09, 2011 04:14PM |
|
edmundo
Re: Importing Data from Excel (XLS) file to HF October 02, 2013 09:51PM |