SSIS Custom Excel Creation - sql

Morning All,
I'm trying to come up with a solution to automatically update a excel report that's currently updated manually(SQL runs and copy and paste job). I've got a few idea's but i'm wondering if there is a way in SSIS that would manage it. Problem is I need to create a file with a specific format, logo at the top, text in line a2, report title a4 and then data a7, b7, c7 ect...
I need the file to update and save as a unique name on the 1st of each month, considered using a sql driven excel data source but then I would need to open, refresh and save. Don't really want to have a scheduled task to run on open and save vb script.
If anyone has any idea's that would be great!

The source file (.txt) looks like this:
F1, F2, F3
1, A1, A2
2, B1, B2
The first line has the field names.
Create your template file. Name it ReportTemplate.xlsx. Create a copy (for now manually) Reort.xlsx
A1: Logo Image
A2: Your Text
A4: Reoprt Title
A6: F1
B6: F2
B6: F3
Make sure there is nothing below line 6.
Now when you connect your source to the destination file (Report.xlsx), SSIS will automatically write from A7.
Once this is done, you would have to create a script task to copy this template to a file and name that file according to your requirement. The connection string for the destination would need to be dynamic. If you need help, please revert back.

Related

How can I create 600+ copies of a word doc, using a naming convention from a spreadsheet?

I have a list of 600 names in a spreadsheet, and I want to quickly create a Word Doc for each with the name in the filename.
I work on a Mac.
Create a formula for the required commands.
The result of the formula should be:
cp "/path/to/original.docx" "/path/to/copy-filename.docx"
So for example, if you want the copy to be called "copy-" then the contents of the A column, the formula might be:
="cp ""/path/to/original.docx"" ""/path/to/copy-" & A1 & ".docx"""
Then fill down the formula down the spreadsheet to create the commands.
Then you can copy the formula result and paste it into a text editor to check it is correct. Once you are satisfied it is correct, you can paste it into a terminal window and the commands will be executed.
If this is a one-off task, this is what I suggest. If you need to do this hourly then you should probably do something different involving a VBA macro.

Import Many Text Files into Single Excel Sheet: One Per Row, Filename in Col. A, Contents in B

I would like to import multiple text files into a single Excel 2016 worksheet. The name of the first text file should go into cell A1, the name of the second text file should go into A2, and so forth. The contents of the first text file should go into cell B1, the contents of the second text file should go into B2, and so forth. What scripting tool or procedure should I use?
Use a vb Script to do this.
I recommend to record bits of what you need to do and learn from the generated code to write what you need.
You will need a VB function that lists files from a directory. Find some useful tips from https://blogs.technet.microsoft.com/heyscriptingguy/2004/10/20/how-can-i-get-a-list-of-all-the-files-in-a-folder-and-its-subfolders/ for this.
You will need a way to import the text files in excel. For this have a look at Vbscript to import csv into excel

VBA: automatically run without a button

So I followed instruction and built a button linked with a VBA code and it works well. Everytime I hit the button, it generates new data in Column C by using data in Column A, Cell B1, and the VBA code. Cell D1 is the sum of data in Column C and it will be generated automatically.
Now, I want to use build-in solver function in Excel. Namely, I want to find best B1 value to maximize D1 value. Is it possible? I think that means I need remove the button and make the VBA code works automatically to generate Column C and Cell D1. Can someone give me some instructions how to do this? Thank you very much!

Can we add Cell border for every row data in Excel writer or Excel output in Pentaho?

I am working on Pentaho data integration and I am appending data into an excel sheet. Data is appending into the excel sheet perfectly but I need to provide the border for every cell. Is there anyway anybody can suggest me?
You can make use of Template feature of Microsoft Excel Output and Writer Steps.
1. Create a template with a cell having a border as per your requirement:
2. Use Microsoft Excel Writer step to define the template:
Make sure to make use of "write to existing sheet" in Excel.
3. In the field section of the Step, make sure to add the style Cell number. In my case it was D2 cell. This will read the data and add border to your data set.
Hope this helps :)
Final Output:

I need to generate new workbooks using existing sheets that I will autopop with data

I have two sheets on my template. Sheet one contains a SKU in column A and a descr. in column B
On sheet 2, I have a pre-written template that has generic SKU and Description. That means under the item sku, it says D999 and under the description it says xxx.
I want to replace "999" with the value in A2 on my first sheet, but the 999 is in multiple columns through the sheet. Next, I want to replace the "xxx" with the data in B2 from sheet 1. I can't seem to find a VBA code that will do this specifically.
Lastly, once the find and replaces are done, I need to have it save me a new workbook using sheet2, in the same format, and name it as the value in A4 on sheet 2. I think you should be able to find the workbook here My Workbook
Basically, I want to be able to enter a bulk amount of new SKUs and Description, and be able to generate a new workbook for each SKU I enter. Right now I have 78 waiting to have sheets made.
In the cell to the right of the cells where you want to type in the SKU, add the following formula: =Match(A2, LookupsheetName!B:B,0). This will return the row the SKU was found on. In the next cell to the right use the Index function: =Index(LookupSheetName!A1:B1000, B2, 0). This will bring the label in column B to the current page. The Match function locates the row the SKU was found on.
Try these for looking up the information, because they are more efficient than VLookups.
The code for copying a worksheet to another workbook can be created using the Macro recorder on the Developer tab. Turn the recorder on then do the steps to manually move/copy to another workbook. When done, open the VBA editor and figure out how to save the workbook to a new name each time.
Good luck.