I have this problem. I have to create an Excel 2007 file dynamically. To do so, I have an Excel connection with the "First Row Are Column Names" check uncheked. Then I created a SQL Task with that Excel connection and the following SQL Statement:
CREATE TABLE `MySheet` (`MyColumn` LongText)
And then I have a Data Flow Task that fills the sheet with a single-column stream of data.
The problem is that even though I unchecked the "First Row Are Column Names" check, the exporting still writes "MyColumn" in the first row. I need to be able to export the data from the first row onward, without any other thing being written on it.
This is a problem because there's the possibility that the Excel file must be overwritten by the SSIS package on a different run. Since we don't have deletion permits in the folder where the file is created, I need to delete the contents of the sheet from the previous run. I manage to do this using a SQL Task and the Excel connection with the statement:
DROP TABLE [MySheet]
This manages to erase every row without deleting the sheet. But, since this task is followed by the Data Flow Task instead of the sheet creation task (because the sheet is still there), when the Data Flow Task fills the rows again, it leaves the first row empty. It doesn't re-write the column name.
This difference is what I'm trying to avoid.
Is there any way to avoid this?
Thanks
Short and sweet answer is no. Not possible. It will always have to use something to make it distinct. What you can do is, use a small poweshell script to open the excel file, run a small macro to delete that first row and then save it and close it. There are a lot of powershell scripts that can help you with this.
Related
I have been trying for days to write an office script to copy rows between sheets based on a value selected in a drop-down list, then delete said row. I have tried many iterations of code but as I’m new to scripts its been unsuccessful every time.
However I was wondering if I needed a script period and could the process be done using Power Automate? I was intending on using it to do the trigger event in any case had the script been successful
Thanks
When I wrote the script it was supposed to copy the row from master sheet paste in the complete sheet to the last row. Delete said row from master.All triggered by a value selected in drop down list.
The scripts had varying outputs but none as intended.
In Blue Prism, I want my work queue to consist of alle files added to a file directory. The item key is the filename. I solve this by reading all the filenames, and then loop through each one, check if it is in the queue, and if not, add it.
There will be thousands of files in the directory, so I don't want to loop through all files every time the process starts.
Alternatively, using "get all completed items", I can get the itemID of the completed items, but then I have to use "get item data" on each one to get the filename to check if the file needs to be added to the queue. Any better ideas ?
That's a interesting problem.
It must be possible to achieve that by doing SQL query on BP database. If you have an access to it, then this might be the simplest and best solution. I can't help you with that though, as I've never done that.
A simpler solution would be to make a snapshot of the input folder whenever the queue in populated and store it. I've did similar thing in my recent project :)
Example flow that would involve a snapshot:
First, I create an Excel workbook with data from current run (in a sheet "New") and a previous run (in sheet "Old"). I'd save it in some kind of internal location.
Get a list of all input files
Open a previous excel workbook
Remove data from "Old" worksheet
Move data from worksheet "New" to "Old"
Paste a list of all input files to "New" worksheet
Save and close Workbook
Run OleDB query to retrieve a list of files that are in "New" sheet, but are not in "Old" sheet.
I'm looking for help with a formula if possible.
I have a sheet within a workbook called 'RAW' and in column 'I' it has a series of agent names. What i want to do is copy these names into the sheet named 'YTD' into column B but in the process of this also remove any duplicates that appear in the new unique list.
The formula i was working with is below however i when i try to amend it to what i need i get circular reference errors. Any help appreciated.
=INDEX(Raw!$I3:$I10000,MATCH(0,INDEX(COUNTIF(Raw!I:I,Raw!i:Raw!i),0,0),0))
For tasks like this, I recommend you use the available manual tools already present in excel. Simply copy and paste the column as you would, and then in your new list, go to the Data Ribbon > Remove Duplicates.
Automation should be used when you have consistently repeating tasks with exactly the same form of input and output. For all of the random things you need to do in excel, relying on automation developed elsewhere can greatly reduce your actual speed at performing these tasks.
I get seven workbooks (xlsx files) from different clients, each with one sheet.
Each sheet has at least one common ID column (UNIQ, PK). One of the workbook contains list of all possible ids. Others may not have record for all ids, but each row has id value defined.
I need to make a final workbook, with first column ID and then union of all remaining columns from each file.
Then I need to send the final.xlsx via email, so its independent of the source files (I'm not sure if its possible to dereference it while retaining the constant values).
Can we do this using VLOOKUP or built-in Excel functions?
If you are going to perform this operation only once. You can do it like this:
Go to the workbook which contains all the IDs(Workbook0)
Apply vlookup in Workbook0 to fetch all the values you need from workbook1
Repeat the process to fetch values from workbook2...3..& so on
Eventually you should have a workbook (workbook0) which will have all the data you want, with ID in first column & rest of the data in further columns
Now to de-reference it, select all the cells which contain formula & press Ctrl+C
Without deselecting, go to Paste -> Paste Special & select Paste Values. This will overwrite the formula cells with only values
Then go to Data -> Connections
Break any connections with other workbooks (if exists)
Save & you are ready to email an independent file
Also, if this is something you have to do very frequently & the steps remain same. I'd suggest that before starting, you click on Record Macro, then perform above steps, tweak that code a little, save it in some other file for future & from next time you won't have to do it manually.
In case you would like to try different approach, take a look at the "Excel Query Wizard" https://superuser.com/questions/722348/merge-and-combine-in-excel/747430#747430
Import the two excel files into Access database.
Use Query wizard to select from the two tables and copy the result to a new excel sheet.
Access and Excel are in the same package so no extra cost.
In an Excel sheet, I have roughly 30 rows x 100 columns of data. Each row represents a different "client". For each client, I've create a summary sheet that is emailed to them and that also contains all the information from my main sheet
Is there a way for Excel to create a new sheet based on some template sheet when I add a new row to my main sheet and fill it with the appropriate data?
I will give you my opinion about your need, the way I see it, at least. It is not a "ready to use" solution, however, only some ideas about the way to do that.
From what I know, there is no way to track insertion of a row in Excel. So you would require a VBA function to be activated on a button, for example. Actually, there is, see Lunatik's answer.
This function would loop over all rows in your main sheet, and create a new sheet when necessary (you would need preferably a unique id for each client, it could be a simple index on the main sheet, depending on the line).
You would create at first your template sheet, with a specific name, and eventually hide it (to not have it in the visible tabs). When I say that the function would create, it would in fact copy this template sheet and give it a unique name (the id I mentioned earlier). You can find ways to copy sheets at this link.
A second operation to do, would be to put data from the row in the main sheet, to the template sheet (if I understood correctly your requirement), which is not really complicated to do in VBA.
If you need this to happen automatically on the addition of a row then you would need to use the Worksheet_Change event to capture the completion of a new row.
This would then generate a new workbook from the template, copy across the necessary ranges then save the new file somewhere, much as Gnoupi says
All this is relatively trivial with VBA, but unfortunately if you aren't familiar with VBA then isn't a simple case of "Do X then do Y in Excel" so I think you may struggle, even with sample code posted here.
Even if I created a dummy model that did what you require, functionally at least, then customising it to your particular needs may difficult if you are not used to working with Excel programmatically.
Edit
I've created a very simple demonstration of how this could work: http://drop.io/4clxof3 - note this example doesn't include the event handling for adding a new row, has almost no validation or error handling and makes sweeping assumptions about almost everything(!)
If you feel comfortable using this a basis for developing your own solution then great. If the whole VBA thing is foreign to you then it may be time to call in reinforcements :)
i was wondering if it was possible with no error catching. Simply just have a VBA code that takes each row of the Excel Document - Creates a file for each row and then at the end combines the total files in a folder into one?
I know sounds weird.. but is this possible?