static void importExcel(Args _args)
{
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
int row = 1;
Name custName;
AccountNum custAccount;
;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
try
{
workbooks.open("Give file path and name here");
}
catch (Exception::Error)
{
throw error("File cannot be opened.");
}
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
do
{
row++;
custAccount = cells.item(row, 1).value().bStr();
custName = cells.item(row, 2).value().bStr();
info(strFmt("%1,%2",custAccount,CustName));
type = cells.item(row+1, 1).value().variantType();
}
while (type != COMVariantType::VT_EMPTY);
application.quit();
}
{
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
int row = 1;
Name custName;
AccountNum custAccount;
;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
try
{
workbooks.open("Give file path and name here");
}
catch (Exception::Error)
{
throw error("File cannot be opened.");
}
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
do
{
row++;
custAccount = cells.item(row, 1).value().bStr();
custName = cells.item(row, 2).value().bStr();
info(strFmt("%1,%2",custAccount,CustName));
type = cells.item(row+1, 1).value().variantType();
}
while (type != COMVariantType::VT_EMPTY);
application.quit();
}
No comments:
Post a Comment