Export to Excel Quickly?
Forums
Hello Everyone,
I use IDEA frequantly and our end product always has to be in excel file. Is there any quick script I could put together which exports the currently active database into an excel spreadsheet on my computer without any dialog boxes? I would like the xlsx file to just retain the name of the active database open (.imb file). I recorded a scripted, but honestly, am not very good with scripting.
Could someone help me to modify it? I feel like 85% of the code is already there.
<code>
Sub Main
Call ExportDatabaseXLSX() 'file1.IMD
End Sub
' File - Export Database: XLSX
Function ExportDatabaseXLSX
Set db = Client.OpenDatabase()
Set task = db.ExportDatabase
task.IncludeAllFields
eqn = ""
task.PerformTask "C:\Data\Desktop\file1.XLSX", "Database", "XLSX", 1, db.Count, eqn
Set db = Nothing
Set task = Nothing
End Function
</code>
How to attach a script to the ribbon
Hi David, like I said before you should attach this to the ribbon so that you have easy access to it.
I would first copy it to your local libray and then attach it to your ribbon. Here are the steps if they don't make sense let me know and I can probably post a vidoe of how to do it.
- Go to your Library (if you are not sure where it is it would be next to the File Explorer tab on the left hand side)
- Under Current Project Library (where your script is stored) open the macros folder and right click on the script and select "copy to local library"
- Now it is part of the local library we will attach it the ribbon.
- Select the Macros ribbon and then select Bind to Ribbon
- In the Choose command select the New button at the bottom.
- Under filename browse to C:\Users\User\Documents\My IDEA Documents\Local Library
- Select the Macros.ILB folder
- Select your script
- Select a symbol from the list
- On the right hand side under "Customize the Ribbon" click on Macros and then click on the New Group button at the bottom.
- Select the Rename button and give it a name, this will create a group so you might want to call it "IDEAScripts" or something. Click ok
- Now select your script from the left hand box and select the Add button. The script will now be found under the IDEAScripts group so you can use it like any other item.
The reason I moved the script to the Local Library is if you ever delete or move the project the script will still be available.
Let me know if this makes sense.
Automatic Excel Output
Hello David and welcome to the site.
Try this out and see if it fits your needs. There is a function Client.CurrentDatabase that gets the current database. I then extracted the name of the database and had to remove the IMD and replace it with the XLSX extenstion. When you run it, it should automatically save an Excel spreadsheet in your project folder.