
) button next to the property field, and in the Select variables dialog box, select the ExcelFile variable.Ĭlick ReadWriteVariables and enter the property value using one of the following methods:Ĭlick the ellipsis (. In the Script Task Editor, on the Script tab, click ReadOnlyVariables and enter the property value using one of the following methods:Ĭlick the ellipsis (. To configure this Script Task exampleĪdd a new Script task to the package and change its name to ExcelFileExists. You can use this Boolean value for branching in the workflow of the package. This example determines whether the Excel workbook file specified in the ExcelFile variable exists, and then sets the Boolean value of the ExcelFileExists variable to the result. For more information, see General Page.Įxample 1 Description: Check Whether an Excel File Exists Set the default scripting language for the Script component by using the Scripting language option on the General page of the Options dialog box. The code samples that read schema information from Excel files require an additional reference in the script project to the System.Xml namespace. NET Framework namespaces at the top of your script file: Most of the code samples require you to import one or both of the following. Enter the complete path of a folder that contains at least one Excel workbook. This value is case-sensitive.ĮxcelFolder, of type String. Enter the name of an existing worksheet or named range in the workbook named in the value of the ExcelFile variable. Enter the complete path and filename to an existing Excel workbook.ĮxcelTable, of type String. Open the Variables window and define the following variables:ĮxcelFile, of type String. To configure a package for use with the examples in this topicĬreate a new Integration Services project in SQL Server Data Tools (SSDT) and open the default package for editing. The samples use many of the same package variables and the same. You can configure a single package to test all the samples in this topic. Configuring a Package to Test the Samples For more information, see Developing a Custom Task. If you want to create a task that you can reuse across multiple packages, consider using the code in this Script task sample as the starting point for a custom task.
