Forum Discussion

richv's avatar
richv
Occasional Contributor
13 years ago

Unloading stores DBTables

I have a large number of DBTables stored in Stores folder which I can happlily view.  Is there anyway that I can unload them into a CSV or excel?  I wish to make a detailed comparison on each field vs my resultant database



Thanks in advance 



1 Reply


  • Hi Richard,


     


    Currently, there's no built-in feature to do this. We have an appropriate suggestion in our DB and your request has increased its rating. Thanks.


     


    Meanwhile, you can use the following TableToExcel function to export data to Excel:


    function test()


    {


      TableToExcel(DBTables.DBTable1, "C:\\DBTable1.xlsx");


    }


     


    function TableToExcel(tableObject, excelFileName)


    {


      var objExcel = Sys.OleObject("Excel.Application");


      objExcel.Visible = false;


      objExcel.DisplayAlerts = false;


      var objWBook = objExcel.Workbooks.Add();


      var objWSheet = objWBook.Sheets(1);


      


        for (var i = 0; i < tableObject.RowCount; i++)


        for (var j = 0; j < tableObject.ColumnCount; j++)


          objWSheet.Cells(i+1, j+1) = tableObject.Values(i, j);


      


      objWBook.SaveAs(excelFileName) ;


      objExcel.ActiveWorkbook.Saved = true;


      objExcel.Application.Quit();  


    }