Do anyone know how to import data from excel but not definition group? I want to read the excel file by coding. Thanks!
Hi, You should use the SysExcel class hierarcy. Please see this for more details. http://www.axaptapedia.com/index.php/Export_to_Excel/Word_-_COM-Interface.
Hi, I found it easier to import from CSV files rather than from Excel. Some code examples could be found here - http://www.harishm.com/Navision/Code.html Regards, Harish Mohanbabu
Thanks both. The current status is our client using a VB program to create a excel file with multiple worksheet, so if using CSV file, there would many files. So i want to read the excel from the code. And i found that there is no content in the page your provide about COM-interface, would you please give me some example? Thanks!
Hi Khue, LOL u’r right… There was when I posted the link [:D]. The code should look something like this: SysExcelApplication ldA; SysExcelWorkbooks ldWbs; SysExcelWorkbook ldWb; SysExcelWorksheets ldWss; SysExcelWorksheet ldWs; SysExcelCells ldCs; SysExcelCell ldCA; SysExcelRange ldR; int i; ; ldA = SysExcelApplication::construct(); ldA.visible(false); ldWbs = ldA.workbooks(); ldWbs.open('C:\test.xls',0,true); ldWb = ldWbs.item(1); ldWss = ldWb.worksheets(); ldWs = ldWss.itemFromName(ldSheetName); ldCs = ldWs.cells(); ldR = ldCs.range('A1'); for (i=1;i<=10,i++) { ldCA = ldCs.item(i,ldR.column()); print ldCA.value().bStr(); } pause; ldWbs.close(); ldA.quit();
Regards, Ciprian
Do you know how to avoid the “Save changes” message when closing the workbook?
Regards.
Carlos