I need to remove the excel password and save (without password) using Interop, so the other processes can read the excel files file without issue. I tried the below code which I found in google but its not removing the password.
Please note, am new to both SSIS and C# and have limited knowledge.
public void Main()
{
string excelFile = "D:\Data\FX File\ZZ_All_Files\Input\SSIS Test PWD.xlsx";
Application xl = new Application();
Workbook wb = xl.Workbooks.Open(excelFile, Password: "ssistest");
wb.Unprotect("ssistest");
wb.Save();
wb.Close();
xl.Quit();
Dts.TaskResult = (int)ScriptResults.Success;
}
code is running fine, but password is not removed from excel workbook. I tried using SaveAs with different file name, but still its not working.