111 How to export data to new excel file every time in ssis

Поделиться
HTML-код
  • Опубликовано: 9 янв 2025

Комментарии • 93

  • @mariahalt4603
    @mariahalt4603 6 месяцев назад

    This is an excellent video. Be sure to watch the last 3.5 minutes!!! It solved my problem by creating an Execute SQL Task to the Excel Connection Manager (not the db) that creates the Sheet needed to dynamically map the columns to the dynamic Excel file.

    • @learnssis
      @learnssis  6 месяцев назад +1

      Thank you Maria for sharing your experience. God bless you.

    • @mariahalt4603
      @mariahalt4603 5 месяцев назад

      @@learnssis I ran into one problem that I think is worth mentioning. The Excel Connection Manager Property, RetainSameConnection, should be set to True to avoid getting error 0x80004005 Description: "External table is not in the expected format.".

    • @learnssis
      @learnssis  5 месяцев назад

      @@mariahalt4603 Oh thats cool. thanks for sharing.

  • @OscarFlores-de1jh
    @OscarFlores-de1jh 4 месяца назад

    It really help me thanks i like this channel ❤

    • @learnssis
      @learnssis  4 месяца назад

      You are most welcome.

  • @yujan9103
    @yujan9103 Год назад

    Amazingly explained. Simple and concise. Well done. 👍

    • @learnssis
      @learnssis  Год назад

      Thank you Uzan for your comment.

    • @conedsalsaclub6091
      @conedsalsaclub6091 11 месяцев назад

      way too fast though. especially if the user is not well versed and is still learning SSIS

  • @hiralbaraniya1824
    @hiralbaraniya1824 11 месяцев назад

    Amazing video and helped a lot . Great Job😇

  • @jennm.3170
    @jennm.3170 11 месяцев назад

    this is a great help! Thank you.

    • @learnssis
      @learnssis  11 месяцев назад

      You are most welcome Jenn.

  • @marty906
    @marty906 4 месяца назад

    10:41 User::Filename is updated automatically without having to execute the task(?) In my project, it never updates - something wrong or not understanding how/when variables update.

    • @learnssis
      @learnssis  4 месяца назад

      You can actually use a foreach loop container to loop through the files from a folder and in the foreach loop container in the variable mapping you can select FileName variable, but make sure you select the "Name and Extension" option in the Foreach loop container at Collection Tab.

  • @KallanaiYT
    @KallanaiYT 2 года назад

    This task will help us more thanks a lot

    • @learnssis
      @learnssis  2 года назад

      Thank you Kallanai for your support.

  • @kevinruiz9624
    @kevinruiz9624 11 дней назад

    Thank you for your videos. There is a way to create a file for each of my clients saved in a table in sql. For example I have 10 clients and they have differents type of data, I was to use my clients table as parameter to create is own file

    • @learnssis
      @learnssis  10 дней назад

      You can store the clients name in a sql table and maybe have a flag active in the table. So if you want to export data for 10 clients then you can set the active flag to 1 for those 10 clients and leave others inactive.
      Now your sql query in the execute sql task will pull the name of clients or sql table name from the table where active=1
      select tablename from config_Tbl where active=1
      and store the result in an object variable using full result set.
      Now you can use a foreach loop container with ado enumerator and can use a table_name ssis variable of string type and can set it at index 0. and can use a data flow task.
      Inside data flow task you can use an OLE DB source, now you can get the table name from table name or view name variable and can get the data for the client and can use a flat file destination to export data to a csv file.
      You can set the connection string accordingly and can pass the table_name ssis variable to flat file connection manager.
      ruclips.net/video/GlznRaeQkx4/видео.html

  • @Booleys
    @Booleys 2 года назад

    Awesome Agil 👍

  • @dianeschuster
    @dianeschuster 2 года назад +1

    You are amazingly knowledgeable. I'm learning so much from you. I tried to find an explanation of why there is sometimes a $ after the worksheet name after you specifically said to choose the worksheet name without the $ in this video. Can you explain what the $ indicates on the end of a worksheet name and why you chose the worksheet name without the $ in this video?

    • @learnssis
      @learnssis  2 года назад +1

      Thanks for your comment.
      In Microsoft Excel, a dollar sign ($) at the end of a worksheet name indicates that the sheet is a "frozen" or "static" sheet. This means that any references to cells on that sheet will always refer to the same cells, even if new rows or columns are inserted or deleted in the spreadsheet.
      The dollar sign is used to "anchor" the reference to a specific cell or range of cells. For example, if you have a formula that refers to a cell on a static sheet like "=SUM(Sheet1$A$1:Sheet1$B$10)", the reference to "Sheet1$A$1" and "Sheet1$B$10" will always refer to cell A1 and B10 on Sheet1, even if you insert or delete rows or columns.
      In contrast, if you remove the dollar signs from the reference, like "=SUM(Sheet1A1:Sheet1B10)", the reference is "relative" to the current cell. so when you copy the formula, it will adjust its references to the sheet, ex. if you copied the formula to cell C3, it would become "=SUM(Sheet1A1:Sheet1B10)"
      In short, the dollar sign makes the sheet reference absolute, it locks the sheet name, the row number and the column letter, so it will not change even if you copy the formula to another cell or sheet.

    • @dianeschuster
      @dianeschuster 2 года назад

      @@learnssis Thank you. Let me be more specific because the answer you provided doesn't seem to apply to the package you created in this video. At 5:37 into your video, you can see what I'm talking about. You specifically said to choose the worksheet name with the $. I created my own package and tried selecting the worksheet with the $ and it seemed to work correctly so maybe it doesn't matter.

    • @learnssis
      @learnssis  2 года назад

      @@dianeschuster Yes you are correct, it won't matter in this case whether you select the sheet with $ or without $.

  • @raguram9974
    @raguram9974 2 года назад

    Awesome! thanks a lot

    • @learnssis
      @learnssis  2 года назад

      You are most welcome Raghu Ram.

  • @jaavithnazeem4507
    @jaavithnazeem4507 10 месяцев назад

    Thanks for this. But is it possible to output the excel in numeric data type instead of text for some of the field? It will be easier for user to do analysis in excel. I couldn't figure out especially for dynamic excel filename.

    • @learnssis
      @learnssis  10 месяцев назад

      This is how data is exported in excel using ssis. Maybe you can create a template file and for every export copy the template file to your destination location and export the data there.
      ruclips.net/video/y5kvWjVNVfc/видео.html
      however as far as I am aware there is no option in ssis to give some columns as numeric and others as text. It will always export data as text.

    • @jaavithnazeem4507
      @jaavithnazeem4507 10 месяцев назад

      Thanks Aqil @@learnssis . My script task to format the excel file is not working in SSIS due to the compilations error. but I got the answer from other video of yours ruclips.net/video/XEnMgLkcbnQ/видео.html. Where I need to properly add the necessary references to make it working.

  • @allworldgadgets8275
    @allworldgadgets8275 2 года назад

    This is helpful, also could you please show CRUD operation in SSIS package. This will be very helpful.

    • @learnssis
      @learnssis  2 года назад +1

      If you want to create
      ead\update\delete data from a sql server table then you can execute any type of query inside execute sql task in SSIS. I have created few videos where you can see how to use the execute sql task to run any type of sql query.
      ruclips.net/video/_8nbAMHXGIQ/видео.html
      ruclips.net/video/oIQlPAnH4xU/видео.html
      ruclips.net/video/6AIM3xkO0H8/видео.html

  • @rizuwanabdulrahim4414
    @rizuwanabdulrahim4414 Год назад

    Thanks for this video bro, but do you know how to not include header row when generating the excel file?

    • @learnssis
      @learnssis  Год назад

      Sorry I don't know.

    • @kevinmcloughlin5988
      @kevinmcloughlin5988 10 месяцев назад

      I have the same question. Were you able to find out how?

  • @Shubhamkumar-ir5ox
    @Shubhamkumar-ir5ox 9 месяцев назад

    First of all Thanks. I want to propose an alternative solution which is easier for me. Use file system task > Configure source and destination variable(create source file path variable and destination file path variable). > Connect to data flow> change Excel file connection from expression

    • @learnssis
      @learnssis  9 месяцев назад

      Yeah that sounds good as well.

  • @raghuchowdary9063
    @raghuchowdary9063 Год назад

    Hi,
    I have used the same process for CSV file export. The question I have is, do we need to use execute SQL task to create CSV file? You have used this to create an Excel file.
    Thanks in advance.

    • @learnssis
      @learnssis  Год назад

      No, for CSV file we don't need to use the Execute SQL Task. The csv file will be created automatically using Flat file destination.

  • @annasuleski3704
    @annasuleski3704 2 года назад

    This is great!!! Thank you so much. I do have a few questions- i will email you !😊

    • @learnssis
      @learnssis  2 года назад

      You are most welcome Anna. Sure you can.

    • @kssabin786
      @kssabin786 Год назад

      Thanks for your question Anna, so we got one more new learning opportunity from Aqil. Thanks lot Aqil 😊

    • @learnssis
      @learnssis  Год назад

      @@kssabin786 ha ha. I got a new topic to make video on 😃

  • @jeevanprakashdash7146
    @jeevanprakashdash7146 6 месяцев назад

    I am getting ole db error so make the delay validation as true but still getting excel connection manager error

    • @learnssis
      @learnssis  6 месяцев назад

      Take a look at this video and try to use the template file.
      ruclips.net/video/rW_GieEjIS0/видео.html

  • @AshishPatel-yl1bk
    @AshishPatel-yl1bk Год назад

    How to replace or overwrite same file incase we have to run job multiple time in same day ?

    • @learnssis
      @learnssis  Год назад

      If you see the video carefully, we are appending the second as well in the time, and none of the package can be executed multiple times in a single second.

  • @kevinmcloughlin5988
    @kevinmcloughlin5988 10 месяцев назад

    Does anyone know how to not include the header row when generating excel files?

    • @learnssis
      @learnssis  10 месяцев назад

      Excel file can not be generated without header row in SSIS.

  • @piyushshrivastava2636
    @piyushshrivastava2636 2 года назад

    Hi ,
    My create table statement is not generating in excel destinations. Can you please help me .

    • @learnssis
      @learnssis  2 года назад

      Can you tell more what is happening ? What error are you getting ?

  • @NanduSravsa
    @NanduSravsa Год назад

    Can we achieve same thing by using script task, please explain

    • @learnssis
      @learnssis  Год назад +1

      yeah we can do same thing using script task. Check this video.
      ruclips.net/video/ZE7jlWuqsvU/видео.html

  • @WarEagleTimeMachine
    @WarEagleTimeMachine Год назад

    Great video

  • @KG-jd7qk
    @KG-jd7qk Год назад

    This is a very helpful video. Thak you. but as i undrestand, this excel file is used as a "template". what if we have to move it each time to a different folder?

    • @learnssis
      @learnssis  Год назад

      You can move the exported excel file to an archive folder using file system task and this package will create a new excel file without any issue if you will rerun it. It is not dependent on old file, it is anyhow creating a new file every time you run the ssis package.

  • @ChandraSekhar-qy9px
    @ChandraSekhar-qy9px Год назад

    When i am trying to run the package from the SSMS job, it is throwing error as opening a rowset for sheet failed check the object exists in the database
    Please help me in this error

    • @learnssis
      @learnssis  Год назад

      Did you ran the package from visual studio from same server or you are trying to run it from different server ?

    • @ChandraSekhar-qy9px
      @ChandraSekhar-qy9px Год назад

      From the same server only, from visual studio the package is running successfully and creating the excel file, but from the job it is throwing the error

    • @learnssis
      @learnssis  Год назад

      @@ChandraSekhar-qy9px Check the owner of the sql services, make sure to use a user who has full access on the machine.
      ruclips.net/video/fIhkb3P3Jss/видео.html

  • @thalesferraz
    @thalesferraz Год назад

    Thanks for sharing

    • @learnssis
      @learnssis  Год назад

      You are most welcome Thales.

  • @Amit-q8l
    @Amit-q8l 6 месяцев назад

    Hi Aqil,
    Thanks for your amazing video which help us lot.
    I have one question can you please resolve if possible.
    Can we open,save and close the excel file using SSIS @scheduled time. Like every day 3 PM that package execute and open the excel file which is in particular folder and save and close the file.
    Awaiting for your response
    Thanks in advance

    • @learnssis
      @learnssis  6 месяцев назад +1

      You can do that using C#. Below is the C# code which can work here. You can put this code in Main method and provide the values to LogFolder path variable, FolderPath variable, and FilePath variables, rest of the code will remain same.
      string currentdatetime = DateTime.Now.ToString("yyyyMMddHHmmss");
      string LogFolder = @"D:\Files\Logs";
      string FolderPath = @"D:\Files";
      string FilePath = @"D:\Files\sdf 3.xlsx";
      string FileName = Path.GetFileNameWithoutExtension(FilePath);
      try
      {
      Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
      string execPath =
      Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
      Workbook book = app.Workbooks.Open(FilePath);
      Worksheet sheet = (Worksheet)book.Worksheets[1];
      if (File.Exists(FolderPath + "\\" + FileName + "_New.xlsx"))
      {
      File.Delete(FolderPath + "\\" + FileName + "_New.xlsx");
      }

      book.SaveAs(FolderPath + "\\" + FileName + "_New.xlsx");
      if (File.Exists(FilePath))
      {
      File.Delete(FilePath);
      }
      book.Close();
      app.Quit();
      if (File.Exists(FolderPath + "\\" + FileName + "_New.xlsx"))
      {
      File.Move(FolderPath + "\\" + FileName + "_New.xlsx", FilePath);
      }
      }
      catch (Exception ex)
      {
      using (StreamWriter sw = File.CreateText(LogFolder + "\\" + "ErrorLog_" + currentdatetime + ".log"))
      {
      sw.WriteLine(ex.ToString());
      }
      }

    • @Amit-q8l
      @Amit-q8l 6 месяцев назад

      @@learnssis can you please share an video with apply this code. Thanks in advance

    • @learnssis
      @learnssis  6 месяцев назад +1

      @@Amit-q8l I don't have a video at the moment, I will try to make a video this weekend and will share it on Monday.

    • @Amit-q8l
      @Amit-q8l 6 месяцев назад

      @@learnssis in this code have to add excel app reference in namespace..like using excel.interop ..is it?

    • @Amit-q8l
      @Amit-q8l 6 месяцев назад

      @@learnssis will wait for your video till the time I will try my end. Thanks 🙏
      Your knowledge is really mind-blowing.thanks a lot

  • @chellurisatish8514
    @chellurisatish8514 2 года назад

    Hi Aqil
    Thanks a lot very clear explanation .
    Can u make a package it should pickup excel file automatically and load into sql as well as in excel destination . once loaded source file should be moved to archive folder. And this should be automatic.
    Thanks in advance.

    • @learnssis
      @learnssis  2 года назад

      I have already created a video on almost same topic, you can check it below
      ruclips.net/video/TH9ptAkCHNA/видео.html

    • @chellurisatish8514
      @chellurisatish8514 2 года назад

      Thanks a looooottttt Aqil

  • @JohuEditz
    @JohuEditz 7 дней назад

    Can we create the file dynamically without header

    • @learnssis
      @learnssis  7 дней назад

      Excel file can not be created without header.

    • @learnssis
      @learnssis  7 дней назад

      However you can create the excel file at run time
      ruclips.net/video/NPYxOpS-kLg/видео.html

  • @prashantsuthar7
    @prashantsuthar7 Год назад

    thanks

    • @learnssis
      @learnssis  Год назад

      You are most welcome Prashant.

    • @prashantsuthar7
      @prashantsuthar7 Год назад

      @@learnssis I have issues with my SP while executing in SSIS. so can I ask for this if you have no problem .

    • @learnssis
      @learnssis  Год назад

      @@prashantsuthar7 Sure go ahead.

    • @prashantsuthar7
      @prashantsuthar7 Год назад

      @@learnssis Thanks, here the SP EXEC MISDB.dbo.RR_PNP_Extract @projectid = '29590,29813,34312,2565',@isenabled = 1
      want to execute in SSIS with multiple dynamic parameters(coming from SQL query Ex: "select projectid from projectmaster" consider as first parameter) after export results as Excel daily with datetime as file name schedule in SQL server agent