dynamic excel file generation duplicate records in ssis - excel

I am currently generating the excel files dynamically using foreach loop+file system task+ data flow task which will load data to the excel files.
But, when i am getting duplicate records instead of over writing already created excel file. I want the duplicate records to load into already created file.
For example if for one product there are four prod items having same name. The file created with a specific product should have all the product items in it.
Please suggest me a solution.
Since this is excel generation which is most hectic thing in ssis.. please try to provide soln elaborately.
Thanks in advance.

Use a script task to see if the file exists. If it does, delete the file and regenerate.
Here are examples:
http://sqlmag.com/sql-server-integration-services/simple-effective-way-tell-whether-file-exists-using-ssis-package
http://sql-articles.com/articles/bi/file-exists-check-in-ssis/
SSIS Script task to check if file exists in folder or not

Related

How to import local excel file into snowflake database table? I will need to do this daily

All -
I've done some research, but I'm having trouble finding a clear answer.
Problem to solve for: I have a dependency where a co-worker updates a local excel file, and I need the information in that file to be imported into a snowflake data table for analysis.
The data structure of the excel file will always be consistent, but I will need to import the new file daily into Snowflake, and it can have as many as 200+ rows every day.
I've attached screenshots of what the excel file structure is. What is the most simple way to enable my co-worker or myself to update the snowflake database table with the new file every day?
The excel workbook will be 2 sheets. I've attached the sample data below. Please help :/
I would likely create a little Python application that loads the Excel file into a Panda dataframe and then loads that dataframe to Snowflake. Something like this might work: https://pandas.pydata.org/pandas-docs/stable/reference/api/…. Once that script is written, you could schedule it to run every day or just manually run it every day.

Excel: Getting data from a daily replaced excel file

I have an location in one drive for business where an .xls file is getting daily replaced via flow automation. The data structure, columns is the same. What I want is to create an excel online workbook that would get its data from that daily replaced xls. I tried once but as soon as the source file got replaced and I clicked on Refresh all under data, the operation ended in error. Any ideas?
You can use Power Query in that scenario. Depending on the exact circumstances, you could
Get data from Folder
Filter the folder to show only files that contain '.xls' in the file name
If after that you still have more than one file, sort them by date modified and keep only the newest one.
Then process that one remaining file.

Is it possible to find the file that is creating an excel file?

I have an excel file that was created by Alteryx, but I'm not sure which Alteryx file generated the excel. I was wondering if there was a way to backtrack and see what program created an excel file.
Thanks
You won't be able to tell which Alteryx workflow created the file, but you can tell that it was created by Alteryx. In the document properties you can find the company that "created" the file which will show up as Alteryx,Inc.
So I've created a very simple workflow that reads in a few lines of a csv and exports to an excel file, "TestOutput.xlsx".
If you then open the .yxmd Alteryx file in a text editor, you can see that it's just stored as .xml ... here's the relevant section for the output:
From here all you need is a way of searching through text files. Using findstr, I can quickly identify the file that produced my excel file:

SSIS - looping through excel files using dynamic file name and sheet name

I am try to load multiple excel files into database, I have tried this link:
How to loop through Excel files and load them into a database using SSIS package?
but it keeps looping through the files and never ends.
can anyone help?
This is not likely given you have a small number of files which you should when testing.
You need to log the file names inside the ForLoop and see if the values are ever changing.
With the dynamic sheet name may have a stability problem, e.g. some characters may not be able to be picked up by the OLEDB driver.
This is in general a not recommended practice to process dynamic data.

How do I call up data from multiple excel files into one constantly updated file?

EDIT: I think this question belongs over at superuser not here at Stackexchange.
What I would like to do is have a single excel file that calls up data from every excel file in a given directory. Specifically if I have a time sheet excel file from multiple people working multiple different job numbers I would like to have that data populated in a single file for everyones times. The directory where the files are stored would be updated weekly so I would want the "master" excel file to reflect the weekly changes automatically...hopefully. Is there an easy way to do this that I would be able to teach someone else?
Import every file to a database table using stored procedure and export one excel file. You can schedule this as a job. Use OPENROWSET and xp_cmdshell. What technology are you using?

Resources