web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Convert Excel to TXT using .Net

(0) ShareShare
ReportReport
Posted on by 15

Hi Guys,

We are using Business Central on prem version 14 and use the NAS to auto process Excel Files to TXT. In NAV 2009 we used below code but after an upgrade to BC it isn't working anymore.
The reason is the NAS isn't able to handle automations anymore. We tried to rewrite the code and use .Net but it is failing. Could you please assist?

PREVIOUS CODE 2009:

IF EXISTS(NewFileName) THEN
ERASE(NewFileName);

IF ISCLEAR(ExcelApp) THEN
CREATE(ExcelApp, TRUE, TRUE);

ExcelApp.ScreenUpdating(FALSE);
ExcelApp.DisplayAlerts(FALSE);
ExcelWorkbook := ExcelApp.Workbooks.Open(FileName2);
ExcelWorkbook.SaveAs(NewFileName, 6);
ExcelWorkbook.Close(0);

ExcelApp.Quit;

NEW CODE BC:

IF ISNULL (XlApp) THEN
XlApp := XlApp.ApplicationClass;
XlApp.ScreenUpdating(FALSE);
XlApp.Visible(FALSE);
XlWorkbook := XlApp.Workbooks.Open(FileName2, 0, FALSE, '', '', '', FALSE, 2, '', FALSE, FALSE, 0, FALSE, FALSE, '');
XlWorkbook.SaveAs(NewFileName, 6, '', '', FALSE, FALSE, 1, '', FALSE, '', '', FALSE);
XlWorkbook.Close(FALSE, '', FALSE);
XlApp.Quit;
CLEAR (XlApp);

I have the same question (0)
  • Suggested answer
    Microsoft Dynamics 365 Business Central Profile Picture
    Microsoft Employee on at

    Hi,

    you can develop your own extension using Al code

    for more info, you can refer to the below link

    community.dynamics.com/.../import-excel-file-using-al-extension---d365-bc

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,556 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,028 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 877 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans