I have tried the various different methods that Excel offers to work with external data.
I have inherited a system in work that involves copy and pasting data from one SSRS report into a pretty complex Excel workbook. I want to automate this system, but for the time being I still have to work with the Excel file.
This Excel file needs to be updated daily - I want to schedule the SSRS report using Windows File Sharing; have it run every day and have the Excel workbook look at the report each time the spreadsheet is opened, updating (adding data to) various tables and cells with the values in the report.
I'm finding this process really unstable. It will work for some reports, but not others. Any pivot charts based on the connection will lose their data and formatting if the sheets cannot link to each other. On opening the main, destination excel file, I get errors about links not being updated, etc. Browsing for the file and reconnecting it works, but this defeats the object.
Could the be something integral to these set up working every time that I might be missing, or does Excel have a feature that better suits what I'm trying to do?
Many thanks for your help!
I'm using SQL Server 2005, Excel 2013 and the reports and datasheet are stored in a shared folder
I think you are heading down a dead-end. You will never have enough control over the rendered output from SSRS and any solution will be fragile.
I assume the SSRS data source is SQL or some other source that Excel can read. I would take the Dataset code from the SSRS report and implement it as Data tables in Excel, e.g. Data ribbon / Get External Data.
In the simplest implementation, each query just populates an Excel Table. You can set the connection definitions to auto-refresh on open.
For more complex requirements you can build an Analysis Model in Excel using the Power Pivot Add-In (included (but not enabled) with Excel 2013). This lets you relate datasets to each other and add calculations etc. The gotcha here is that you cant auto-refresh without SharePoint.
Related
I have created a report in SSRS that is several tables. I can export the report to Excel easily enough but the users want to have the ability to input their own numbers in a line below the tables. This line (y) would be followed with another summary line(y+z, or x-y=z, whatever). Yes, they can open the report insert extra lines, add formulas and formatting... but since this report will be run monthly and there are 11 tables in this report it would be nice if there is a Power Automate solution to add lines, formulas and formats or some other solution. Feel free to post potential solutions or teaching resources that may allow me to piece together a solution. Thank you.
I haven't tried anything yet. The only solution I can do at the moment is create a Excel template where I paste the exported spreadsheet and it gets 'lookedup' by a second tab with the proper/end formatted spreadsheet. Would like to modernize the solution(and learn)....although learning VBA is not solution I am looking for....
I have a series of Business Objects (Webi 4.2) reports which are scheduled to be exported to Excel each day.
These reports form the basis of a Power BI dashboard.
Power BI is much happier looking at Excel Tables that it is simply worksheets so I would like to get webi to export to excel but create the exported file as an excel table.
This seems to be something that should be simple but countless hours of googling have not come up with an answer.
By default will be to use macros in excel but it seems a bit messy for something that webi could do?
Just want to have final check in the community before I go down the macro route.
A macro is likely your best option; BO can only generate a simple Excel worksheet.
I am trying to develop a manner in VBA to track changes in a document without having to hide the contents in an extra sheet within a workbook.
I understand that if you change the extension of an Excel file to ".zip", you can access the Excel document as components sorted into directories. Is there a way to save and write to a text file within one of these directories so that I can access it every time the document is opened, without having to have the user drag a log file along with the Excel document?
Some facts:
When Excel opens the file, the file is blocked by Excel. There is no possibility to write to that file within VBA
You can store additional data into that file externally or after the Excel workbook has been closed
You would need to have code externally from the workbook to accomplish writing to that file after it has been closed. You may want to use VSTO or an oldschool Excel Addin.
you have to ensure that Excel will not destroy your changes when restructuring or repairing the file.
In the first run, your idea sounds very natural, to not use sheets from a programmer's point of view. You only have full control on Excel files when
you use external libraries (e.g. Spreadsheet Gear) or
you remote control Excel via automation.
you use openxml SDK for Excel
you use VBA
You could insert additonal information and take care that this information is not skipped by Excel.
When you want to do the tracking this way, I would suggest you to use an Excel Addin. There is actually no need for installation when using this kind of Addin. Attach to open workbook and close workbook events and ensure that all changes are written to the Excel Workbook after it has been closed. Certainly you would have to attach to all kind of other events to track all changes to the workbook. You may need to have in mind that there can be more than one workbook opened at a time.
Actually there are alternatives.
write your logging code in VBA or whatever fits
abstract away how your persist the code (e.g. use a data provider)
think about these two alternatives to store logging data:
You can save logging data in cells of excel. When using a "newer" version of excel, you have a limit of 1 million rows. You may want to implement a rolling mechanism that ensures that you never go over the border of 1 million records. (you may be dont want to track a million changes)
You can use the document properties to store you information as xml.
Last but not least, the most obvious: Why not using Excel's functionality of tracking changes? Understand track changes in Excel 2013
"The Business" wrote a sophisticated Excel VBA Macro that scans multiple complex and irregular (multiple logical tables per tab) spreadsheets and produces a summary XLS. Management wants IT to "productionize it" and run it on a server.
I've seen example of using the Jet drive to read regular tables (1 per tab) in a spreadsheet, but the spreadsheets are irregular and this macro does more than read, it sets cell formulas, etc. Therefore, I guess we need full VBA.
How do you do this in production if you can't install Excel on a production server?
You can use a library for interacting with Excel files like Spreadsheet Gear for instance... I am sure there are plenty of others. You can then read the Excel files and then produce the summary XLS. You'd need to tie it all together using VB. You wouldn't need to install Excel on the production server though.
Current Excel Report is created using Jasper Server / Jasper Report 3.8.
In my case , I would like to create Pivot Excel automatically using Excel(Since Jasper Report Crosstab is not sufficient for my client requirement), so i have an idea to add VB Script that will create Pivot Table when the generated jasper report is opened for first time.
I have created the VBA script However I couldn`t find a way to integrate the VBA with Jasper Report (generated) so that when I generated the Report, the VBA is also included in the Report.
Could anyone tell me how to to add VB Excel Script in Excel Generated Jasper Report?
Added Constraint:
List item
The Data Source (Excel File Containing Data) is protected
I know the question has been answered and accepted, but I just cannot resist to add a thought .....
Could it be that this question is asking to put the cart in front of the horse?
You create an Excel File REP using a report generator. Then you want to use this data as the source of an Excel Pivot table. As I see it there are a couple of possibilities to do that:
Create another Excel file PIV containing a structure of REP with some sample data to create the Pivot definitions
Copy / Paste the REP data replacing the existing content each time you draw a new REP
refresh the Pivot
This can be automated in PIV, asking for the source file name etc., so there is actually no need to touch REP in any way. As an alternative to copy / paste you can just use an external link to REP when you specify the data source for the pivot table, and change this every time the user wants to analyze a new REP.
Hope this helps
I think MikeD has the right idea here. I've never used Jasper, but if it's a CSV or Excel file, why not write a block in your macro script that opens the Jasper report, makes the pivot table then saves it again.
It's honestly been years since I've done VBA but this code was what I found online for opening workbooks (ref: http://p2p.wrox.com/excel-vba/10510-opening-excel-file-vba.html)
Dim oExcel as Excel.Application
Dim oWB as Workbook
Set oExcel = new Excel.Application
Set oWB = oExcel.Workbooks.Open(<pathToWorkbookHere>)
Forgive the syntax on this as it's from 10 year old memories, but from there, you could do things like
oWB.Sheets(1).Cells.Copy
ThisWorkBook.Sheets("PIVOTDATA").Cells.Paste()
ThisWorkBook.Sheets("PIVOTTABLE").Cells.Refresh
ThisWorkBook.Saveas("<path to new report>", xlExcel12)
If your reports are done by date, you could programatically select either the latest, load the folder and parse all of them, or whatever you'd like. Your template file is the one running the script, and saves copies of itself in a "does not contain a macro" state, so your users never get the security warning.
If you correctly determine the filename programatically, set the code to run "ON OPEN" in the template macro, and run a thisworkbook.close at the end of the script, all you've got to do is create a batch file that opens your workbook automatically on the command line
excel.exe <template_filename>
then set a windows cron-job (called a scheduled task) to run automatically every day, right after your jasper report runs.
Sorry if some of this is "hit and miss" in terms of syntax. I've not been elbows deep in Excel VBA for over 10 years, but I wrote a system like this at the time that was generating hundreds of beautifully formatted excel reports every day ... pivot tables and all.
It's totally achievable and you're on the right track.
By looking the answer on Jasper Tracker, seem that this feature is not supported by jasper report and will not be including in new feature
this (Adding VBA Script to Excel Generated Jasper Report) is such a specific Excel feature that I'm pretty sure we will
never implement. This is mostly because JasperReports is not an XLS
generating library, but rather a reporting tool with Excel output
capabilities
See this link for detail.