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

Notifications

Announcements

Community site session details

Community site session details

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

CSVBuffer with different number of columns per line

(5) ShareShare
ReportReport
Posted on by 41
When using the CSVBuffer to export data, the below code expects each line to have the same number of columns.
 
 
This is not always the case when writing a CSV. Has anyone had to create a workaround for this? Or should it be submitted as a bug to Microsoft?
I have the same question (0)
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    21,048 Super User 2025 Season 2 on at
    Not sure but check this if helps: https://www.youtube.com/watch?v=cp91N4xFqlg
  • Suggested answer
    Jainam M. Kothari Profile Picture
    15,641 Super User 2025 Season 2 on at
    Hello,
     
    The issue you're facing with the CSVBuffer expecting each line to have the same number of columns can be addressed by either pre-processing the data to ensure uniform column counts or implementing a custom CSV writer that handles varying column numbers. If these solutions don't work, consider submitting it as a bug to Microsoft for a more flexible CSVBuffer.
  • Suggested answer
    Suresh Kulla Profile Picture
    50,251 Super User 2025 Season 2 on at
    You should always have same number of columns for each row, if you don't have the data in the a specific column you still need to send blank empty. 
  • Suggested answer
    YUN ZHU Profile Picture
    96,039 Super User 2025 Season 2 on at
    Hi, Try TextBuilder Data Type, you can change the number of columns at will, just add some conditions.
    How to export data from tables to CSV (comma-separated values) file -> Using TextBuilder Data Type
     
    Hope this helps.
    Thanks.
    ZHU
  • Gerardo Rentería García Profile Picture
    25,396 Most Valuable Professional on at

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,585

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 780 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 712 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans