Forum Discussion

Adagio's avatar
Adagio
Frequent Contributor
6 years ago

Is there a way to export a DB table to an excel sheet?

Hi,

 

I have a dbTable having  >400K rows and want to export it to an excel sheet.

What I'm doing right now is reading one value at a time and copying it to the spreadsheet.

 

Is there a way to copy all the data with just one command? Any help would be appreciated.

 

Thank you

Abhi 

 

8 Replies

  • anupamchampati's avatar
    anupamchampati
    Frequent Contributor
    use batch and export to csv very simple.and easy to use

    sqlcmd command lines like connections strings db name and -i input sql file (you can specify the query which output you want to export)
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Not native to TestComplete, no.  There are some SQL commands that you can execute to do such, requiring certain drivers to be present on your SQL server.  But generally, if you're reading the values in via script and then exporting out also via script, that's the best option you have at the moment.

    • Adagio's avatar
      Adagio
      Frequent Contributor

      Thank you Valla, I was actually trying ot find a way to copy all the rows faster. This solution also goes row by row, so it would be significantly slow while copying around 400k rows to an excel.

       

      Appreciate you taking time looking at this.

       

      Thank you

      Abhi 

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Let's approach from perhaps a different direction.  What's the purpose for the output to XLS?  What are you intending to do with it?