So I have a folder in which excel files get loaded daily. I need to create a package that extract those files to a sql table. However, the file changes name daily as the name comes with the current date,so the filename would be like filename+currentdate(name20140801.xlsx).
I tried using a variable that has filename?.xlsx/filename?*xlsx as a excelpath property for the excel connection manager but the task gives me an error DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.
Does anyone know how i can do this using the Data Flow task( I am trying to avoid Script task)
Thank you!
Related
I developed SSIS package which load excel file from Source named Input Folder and after loading it moves to success or failure Folder. Package is running fine. I am just facing one issue that when i open excel connection manager and close without doing any changes it create a (sample empty excel) file in the input folder and when i place my actual excel in input folder and execute package package move my actual excel to success and the other (sample empty file) to failure. Can anyone help me to resolve this issue why is this happening? Thanks.
So I created a ForEach loop and a data flow task to write from Excel to SQL DB. All works fine with the Excel source hard coded. As soon as I change the connection string to use the file path variable as a data source, I get this error:
[Excel Source 1] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Excel Connection Manager 1" failed with error code 0xC0202009.
I print the file path in a message box before executing the data flow so I know that the variable is working.
Naturally I browsed tons of answers and tutorials, but nothing. Here's what I tried:
Changing the data source on the connection string
Using the ExcelFilePath expression instead of the connection string
Changing the Excel file name in the connection manager properties
Ran the package in 32 bits
Set delayed validation to True in all data flow tasks and connection manager
Deleting and creating a new connection manager
Combinations of the above, lots of trial an error
I'm using Visual Studio 2013.
I'd appreciate your help as I've been plucking my hair all afternoon with this :)
I never got this to work, so I imported the Excel files to the DB using SQL:
SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=C:\Test\Excel_Data.xlsx;', 'SELECT * FROM [Sheet1$]')
https://www.sqlshack.com/query-excel-data-using-sql-server-linked-servers/
I have qvw file with sql query
Data:
LOAD source, color, date;
select source, color, date
as Mytable;
STORE Data into [..\QV_Data\Data.qvd] (qvd);
Then I export data to excel and save.
I need something to do that automatically instead of me
I need to run query every day and automatically send data to excel but keep old data in excel and append new value.
Can qlikview to do that?
For that you need to create some crazy macro that runs after a reload task in on open-trigger. If you schedule a windows task that execute a bat file with path to qlikview.exe with the filepath as parameters and -r flag for reload(?) you can probably accomplish this... there are a lot of code of similar projects to be found on google.
I suggest adding this to the loadscript instead.
STORE Table into [..\QV_Data\Data.csv] (txt);
and then open that file in excel.
If you need to append data you could concatenate new data onto the previous data.. something like:
Data:
load * from Data.csv;
//add latest data
concatenate(Data)
LOAD source, color, date from ...
STORE Data into [..\QV_Data\Data.csv] (txt);
I assume you have the desktop version so you don't have access to the Qlikview Management Console (if you do, this is obviously the best way).
So, without the Console, you should create a txt file with this command: "C:\Program Files\QlikView\Qv.exe" /r "\\thePathToYourFile\test.qvw". Save this file with .cmd file extension. After that you can schedule this command file with the windows task scheduler.
Using an existing SSIS package, I was trying to import .xlsx files we received from a client. I received the error message:
External table is not in the expected format
These files will open in XL
When I use XL (currently XL2010) to Save As... the file without making any changes:
The new file imports just fine
The new file is 330% the size of the original file
When changing .xlsx to .zip and investigating the contents with WinZip:
The original file only has 4 .xml files and a _rels folder (with 2 .rels files):
The new file has the expected .xlsx contents:
Does anyone know what kind of file this could be?
It would be nice to develop my SSIS package to work with these original files, without having to open and re-save each file. There are only 12 files, so if there are no other options, opening/saving each file is not that big of deal...and I could automate it with VBA going forward.
Thanks for any help anyone can provide,
CTB
There are many Excel file formats.
The file you are trying to import may have another excel format but the extension is changed to .xlsx (it could be edited by someone else) , or it could be created with a different Excel version.
There is a Third-Part application called TridNet File Identifier which is an utility designed to identify file types from their binary signatures. you can use it to specify the real extension of the specified file.
Also after a simple search on External table is not in the expected format this error is thrown when the definition (or version) of the excel files supported in the connection string is different from the file selected. Check the connection string used in the excel connection manager. It might help to identify the version of the file.
Here's what I'm doing:
I'm using a Foreach Loop container to grab any .xlsx files in a specified folder and assigning the fully qualified name to a variable called FileName.
Then I have a data flow with an Excel source importing to an OLE DB Destination.
How do I make the excel source the FileName variable?
--When I create the same process for flat files I have no problems creating an expression and changing the delay validation to true but when I try excel files it doesn't work the same. I've been able to work around the problem by using a file system task to move the xlsx files to a new folder giving it a static name and importing from that file, but I'm tired of doing that. Any help will be greatly appreciated!