How to Encrypt the password to Excel using SSIS package?
I thought, we can use script task to achieve this. I tried the below code by using the Spire.xls nugget package but the respective nugget dll reference are not adding to the solution.
Script task Code:
using Spire.Xls;
namespace ProtectExcel
{
class Program
{
static void Main(string[] args)
{
//Load Workbook
Workbook book = new Workbook();
book.LoadFromFile(@"C:\Test\Test.xlsx");
//Protect Workbook
book.Protect("vinay-123");
//Save and Launch
book.SaveToFile(@"C:\Test\ProtectExcel.xlsx", ExcelVersion.Version2010);
//System.Diagnostics.Process.Start("ProtectExcel.xlsx");
}
}
}
I tried the same code in c# console application it worked well but not working in SSIS script task.
Can anyone help me on this how to fix this or any other approach??
Script task Code:
using Spire.Xls;
namespace ProtectExcel
{
class Program
{
static void Main(string[] args)
{
//Load Workbook
Workbook book = new Workbook();
book.LoadFromFile(@"C:\Test\Test.xlsx");
//Protect Workbook
book.Protect("vinay-123");
//Save and Launch
book.SaveToFile(@"C:\Test\ProtectExcel.xlsx", ExcelVersion.Version2010);
//System.Diagnostics.Process.Start("ProtectExcel.xlsx");
}
}
}
Excel should be protected with password by using SSIS.