Mass export to excel - data selection based on keys
Forums
Hi there,
I am dealing with a mass export of data from idea databases to e.g. excel files now, but unfortunatelly I am not getting on well with that. :-(
I will try to describe the situation:
I prepared a database containing accounting data (booking entries) in IDEA. Then I did a selection based on key values (Data - Selections - Selection based on key values...). The key value is an G/L Account. IDEA created several individual databases (imd files) - for each key value (G/L Account) one database. Now I want to export all the individual databases to excel. There is no option to do that on mass. In case of big amount of key values (e.g. 100), it is annoying to do the export 1 by 1.
I tried to do a test script: I did the export for one value (G/L account 1) first, then I copied the script from "History" and extend the script for the second value (G/L account 2). When I triggerred the script, it went to error ("Error on line xx - Duplicate definition: myArray).
Is there any chance to do the mass export from IDEA?
Thank you for any idea. :-)
Dan
Hi Baricha,
Hi Baricha,
Well the script I would consider for advanced users as it has you creating code to manipulate Excel. I will try and explain what the script does. In the Sub Main you are setting up your list of IDEA files that you want exported and then merged into one Excel file. You then call the createExcelSheet function.
It first creates an array sExcelName() to hold the names of the Excel file names. The array is made the same size as the sExcelExportList by using the ubound function (this gets the number of items in an array or the upper boundary of an array).
For For Next loop takes the name of the IDEA filed, strips off the IMD and adds the XLSX file extension. It then calls the IDEA task to export the file to the Exports.ILB directory under the project folder.
At this point you have all your files as separate Excel files.
The next block of code creates an Excel object and creates a new Excel file in the Exports.ILB folder that will hold all your separate Excel files.
The next block then uses a for next loop that opens each individual Excel spreadsheet, copies the information from the worksheet and then pastes it into a new worksheet in your new Excel spreadsheet. The code then does an autofit so that the column widths show all the information.
It then closes each of the Excel spreadsheets, once everything has been copied over it saves the new worksheet, closes it and exists Excel.
Hopefully that makes a bit more sense.
Thanks
Brian
Dear Brain
Dear Brain
It has partly worked, It exported the 4 files to my IDEA exports but failed creating a new excel workbook for combining the 4 files.
Kindly note i had done this
Set fso = CreateObject("Scripting.FileSystemObject")
workDir = Client.WorkingDirectory
Path = workDir
Kindly see attached.
Hi Barachi,
Hi Barachi,
Thanks for also posting the code. From your code this is mostly like the problem. You placed:
Const EXCEL_FILENAME = "Bulk_Results.XLSX" 'name of new excel file
In the sub main, you need this as a global variable so remove it from the sub main and place it above the sub main, in the area where you declare your Global variables.
That should hopefully fix your error.
Brian
Dear Brian
Dear Brian
Thank you very much for your response. I appreciate your help. I have a challenge understanding the code you wrote. I am new to IDEA.