My code is and got error like
static void RB_ReadExcel(Args _args)
{
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
FilenameOpen fileData = @"C:\import_journal.csv";
int row = 1;
date dat;
real salary;
int vou;
str TransType;
str account;
int value;
str descr;
int deb;
int credit;
str ack_type;
int offset__Account;
int totNoOfLeaves;
;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
fileData = "C:\\import_journal.csv.xlsx"; // file path
try
{
workbooks.open(fileData);
}
catch (Exception::Error)
{
throw error("File not found");
}
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
//Iterate through cells and get the values
do
{
//Incrementing the row line to next Row
row++;
dat=cells.item(row,1).value().date();
salary=cells.item(row,2).value().decimal();
vou=cells.item(row,3).value().char();
value=cells.item(row,4).value().int() ;
deb=cells.item(row,5).value().int();
credit=cells.item(row,6).value().int();
offset__Account=cells.item(row,7).value().int();
info(strFmt("Date=%1, Salary=%2, Voucher=%3 ,Value=%4 ,Debit=%5,Credit=%6,Offset=%7",dat,salary,vou,value,deb,credit,offset__Account));
// Loads the next row into the variant type and validating that its is empty or not
type = cells.item(row+1, 1).value().variantType();
}
while (type != COMVariantType::VT_EMPTY);
// quits the application
application.quit();
}
*This post is locked for comments