How to Create New Excel Sheet

amrit010amrit010 Member Posts: 4
Hi,
If the entries that are exported to excel have exceeded more than 1048576 entries then automatically, create a new sheet and enter the data in the new sheet?

Is it possible?

I tried the below link, but couldn't succeed, by writing doing my own customization.
https://saurav-nav.blogspot.com/2015/07/nav-2013-r2-multiple-sheets-in-excel.html



My aim is to extract Data of Item Ledger Entries without any filter, if the entries exceed the limit of excel sheet rows, i.e 1048576, then a data must get created in new sheet?/


Thanks in Advance

Answers

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    edited 2018-07-04
    In the blog entry you've mentioned there is a code sample how to create additional worksheet. You can use it to modify Excel Buffer function to create new spreadsheed after writting 1m+ line, or you can use Exce Buffer code + examples from the blog to write your own function to export directly from Item Ledger Entry. The idea here would be to create new worksheet writer in the middle of Write loop, and keep writting in the loop to the new worksheet var (resetting the row counter the new spreadsheet will be filled up from row 1).

    So the answer is yes, it is possible, but does it make any sense? Having a 1m+ entries spreadsheet opened in Excel will make the app crawl, most likely almost unusable. Try creating manually a dummy spreadsheed and fill it up with 1m+ rows resembling the content exported from the Item Ledger Entry and test this before writting any code.
    If you think about exporting item ledger entries in order to copy them to another database then a flat file will be probably a better option (still being most likely unopenable/uneditable in most text editors)
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Sign In or Register to comment.