Hi,
I have to read the Data from Excel sheet. Here below is my Excel sheet.The First item id i cant able to read the Second row i able to read. Any Suggestions please. I have tried formatting Cells but it hasn't help for me.
Regards,
Ram.
Hi,
I have to read the Data from Excel sheet. Here below is my Excel sheet.The First item id i cant able to read the Second row i able to read. Any Suggestions please. I have tried formatting Cells but it hasn't help for me.
Regards,
Ram.
And do you get some error when you run it? What error? What line of code causes the error?
Hi Ziyao,
Here is my code to read the Item id from Excel sheet.
static void ReadingExcel(Args _args) { SalesTable salesTable; SalesLine salesLine; NumberSeq numberSeq; SalesFormLetter salesFormLetter; SalesFormLetter_PickingList salesFormLetterpick; SalesId salesId; InventDim inventdim; Dialog dialog; DialogField file; SysExcelApplication application,application1; SysExcelWorkbooks workbooks,workbooks1; SysExcelWorkbook workbook,workbook1; SysExcelWorksheets worksheets,worksheets1; SysExcelWorksheet worksheet,worksheet1; SysExcelCells cells,cells1; SysExcelCell cell1; SysExcelFont font; COMVariantType type,type1; FileName filename,filename1; str Custaccount,itemno,salesunit; real quantity; real salesprice; int row=1; int row1 = 2; dialog = new Dialog("Please select the file to load"); dialog.addText("Select file:"); file = dialog.addField(ExtendedTypeStr("FilenameOpen")); dialog.run(); if (dialog.closedOK()) { info(file.value()); application = SysExcelApplication::construct(); workbooks = application.workbooks(); //specify the file path that you want to read filename =file.value(); //ExcelSheet File Name try { workbooks.open(filename); } catch (Exception::Error) { throw error('File cannot be opened'); } workbook = workbooks.item(1); worksheets = workbook.worksheets(); worksheet = worksheets.itemFromNum(1); //Here 1 is the worksheet Number cells = worksheet.cells(); do { row ; itemno = any2str(cells.item(row,2).value().bStr()); info(itemno); type = cells.item(row 1, 1).value().variantType(); } while (type != COMVariantType::VT_EMPTY); workbooks.close(); application.quit(); info("Done!"); } }
Regards,
Ram.
Can you share with us any details about how you are reading data from Excel sheet? Seems you forgot to mention it.
Are you using one of the out of the box functionalities (defintion groups, DIXF) or did you write some own code?
Is this a customized import function or it's a standard build in import function? If it is a build in standard function, could you please indicate where it exactly placed?
Hi Ziyao,
My code can't able to read the only integer values(Eg:1000), but it can able to read the Values which is Suffixed with String (Eg: "D001"). that's what the issue i am facing now. can you able to understand my issue.
Regards,
Ram.
Hi Ram, normally the first and send row in excel stores header and template information, try to start your first item on Row 3.
For build in import by excel function, you need to copy paste your data to the excel template exported and then import by system, if this import by excel function is customized, please check your code.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156