Start a new topic

Excel Export - One Click

I'm using DbVisualizer 9.5.1


I used to use Aqua Data Studio.  That program had a feature called "View as Spreadsheet".  I so miss that feature.  Here's an example of what it did.


First, user writes a query and returns a recordset into the grid.


Second, user clicks an icon on the grid toolbar "View as Spreadsheet".


Third, user is brought to a new Excel workbook with the grid (columns and rows) provided.


That's it!  It's oh so simple but oh so nice.  I realize users can export to a file but this is so handy when you want to do a little bit of analytics on some ad-hoc analysis.  Often I don't need to save my results.  I just want to check something out and Excel is a very powerful tool for that type of work.  What Aqua did to marry their tool up with Excel was genius.  I might urge you all to consider this functionality.


If you want the DbVisualizer's implementation to be even better than Aqua's I would urge the process makes two worksheets in the workbook.  The first worksheet would be the grid results.  The second worksheet would be the code used to generate the results.  THAT WOULD BE AWESOME!!!!


http://www.aquafold.com/d10/docs/10.html




I want to share an Excel macro that does just what I suggested -- moves the query to a new tab named "Query", moves the other columns up, and autofits them, all ready to email.

 

Sub DbVis_reformat()
'
' DbVis_reformat Macro
' Gets a spreadsheet exported from DbVisualizer ready to email.
' Moves the query to its own tab and autofits the columns.
'
' Keyboard Shortcut: Ctrl+d
'
    Sheets.Add After:=Sheets(Sheets.Count)
    Sheets("Sheet2").Select
    Sheets("Sheet2").Name = "Query"
    Sheets("Sheet1").Select
    Sheets("Sheet1").Name = "Data"
    Range("A2").Select
    Selection.Cut
    Sheets("Query").Select
    ActiveSheet.Paste
    Selection.Columns.AutoFit
    Range("A1").Select
    Range("A1").WrapText = True
    Selection.Columns.AutoFit
    Sheets("Data").Select
    Rows("1:3").Select
    Selection.Delete Shift:=xlUp
    Cells.Select
    Selection.Columns.AutoFit
    Range("A1").Select
    
End Sub

 Hope others find this useful.

Login or Signup to post a comment