Upload XL template then import into SQL with DTS

Results 1 to 2 of 2

Thread: Upload XL template then import into SQL with DTS

  1. #1
    Join Date
    Dec 1969

    Default Upload XL template then import into SQL with DTS

    Hi I'm trying to figure something out here and haven't come up with a solution that works. I've got a web page where a user will go and upload an Excel file (persists upload). That file gets placed on the webserver and then I want to import that data in using a sql DTS package. I can get the template uploaded just fine. I control what the template looks like and it will always be the same format. I'm having to rename these templates using randomly generated text/numbers so that I don't get two uploads that have the same name and/or at the same time. The problem that I am having is having this DTS package accept whatever name I give the file. I can write a DTS package that looks to a certain path and file name to import a file but I haven't figured out how to do this by somehow passing in a variable - in this case the file name. Any suggestions will be greatly appreciated. Thanks.

  2. #2
    Join Date
    Dec 1969

    Default RE: Upload XL template then import into SQL with D

    This might help,<BR>I had a budget system that created and sent out XL Workbooks to various employees with account codes selected for each User&#039;s responsibility. The Workbooks got returned and were placed into a designated folder.<BR><BR>Then I used VBA code loops to find each file "*.xls" in the folder and runs the import code:<BR><BR>gstrABMDir = "designated folder"<BR> stFile = Dir(gstrABMDir & "*.xls")<BR> Do While stFile &#060;&#062; ""<BR> "Test to ensure Workbook is correct format"<BR> "Import Code"<BR> stFile = Dir<BR> Loop<BR><BR>After the import you can either kill the file or move it to a different folder or add its name to a table and use this to check so you don&#039;t re-import it.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts