Security (10)
A digital signature is a type of electronic signature that can be used to verify the authenticity and integrity of digital documents. It can help recipients identify where the digital documents originate from and whether they have been changed by a third party after they were signed. In this article, we will demonstrate how to add or delete digital signatures in Excel in C# and VB.NET using Spire.XLS for .NET.
- Add a Digital Signature to Excel in C# and VB.NET
- Delete All Digital Signatures from Excel in C# and VB.NET
Install Spire.XLS for .NET
To begin with, you need to add the DLL files included in the Spire.XLS for .NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.XLS
Add a Digital Signature to Excel in C# and VB.NET
You can add a digital signature to protect the integrity of an Excel file. Once the digital signature is added, the file becomes read-only to discourage further editing. If someone makes changes to the file, the digital signature will become invalid immediately.
Spire.XLS for .NET provides the AddDigitalSignature method of Workbook class to add digital signatures to an Excel file. The detailed steps are as follows:
- Initialize an instance of the Workbook class.
- Load an Excel file using Workbook.LoadFromFile() method.
- Initialize an instance of the X509Certificate2 class with the specified certificate (.pfx) file path and the password of the .pfx file.
- Initialize an instance of the DateTime class.
- Add a digital signature to the file using Workbook.AddDigitalSignature(X509Certificate2, string, DateTime) method.
- Save the result file using Workbook.SaveToFile() method.
- C#
- VB.NET
using Spire.Xls; using Spire.Xls.Core.MergeSpreadsheet.Interfaces; using System; using System.Security.Cryptography.X509Certificates; namespace AddSignatureInExcel { class Program { static void Main(string[] args) { //Create a Workbook instance Workbook workbook = new Workbook(); //Load an Excel file workbook.LoadFromFile("Sample.xlsx"); //Add digital signature to the file X509Certificate2 cert = new X509Certificate2("gary.pfx", "e-iceblue"); DateTime certtime = new DateTime(2020, 7, 1, 7, 10, 36); IDigitalSignatures signature = workbook.AddDigitalSignature(cert, "e-iceblue", certtime); //Save the result file workbook.SaveToFile("AddDigitalSignature.xlsx", FileFormat.Version2013); } } }
Delete All Digital Signatures from Excel in C# and VB.NET
Spire.XLS for .NET provides the RemoveAllDigitalSignatures method of Workbook class for developers to remove digital signatures from an Excel file. The detailed steps are as follows:
- Initialize an instance of the Workbook class.
- Load an Excel file using Workbook.LoadFromFile() method.
- Remove all digital signatures from the file using Workbook.RemoveAllDigitalSignatures() method.
- Save the result file using Workbook.SaveToFile() method.
- C#
- VB.NET
using Spire.Xls; namespace DeleteSignatureInExcel { class Program { static void Main(string[] args) { //Create a Workbook instance Workbook workbook = new Workbook(); //Load an Excel file workbook.LoadFromFile("AddDigitalSignature.xlsx"); //Remove all the digital signatures in the file workbook.RemoveAllDigitalSignatures(); //Save the result file workbook.SaveToFile("RemoveDigitalSignature.xlsx", FileFormat.Version2013); } } }
Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
If your worksheet has some important formulas that you don’t want others to view, you may want to hide these formulas. This article demonstrates how to hide formulas when protecting a worksheet using Spire.XLS and C#.
The XlsRange.IsFormulaHidden property is used to determine if the formula will be hidden when the worksheet is protected. You can hide the formulas in a specific cell range by setting the XlsRange.IsFormulaHidden property to true, but note that the formulas can be hidden only if the worksheet is protected, they won’t be hidden if the workbook is protected while the worksheet is not.
using Spire.Xls; namespace HideFormulas { class Program { static void Main(string[] args) { //Initialize an object of Workbook class Workbook workbook = new Workbook(); //Load the Excel file workbook.LoadFromFile("Input.xlsx"); //Get the first worksheet Worksheet sheet = workbook.Worksheets[0]; //Hide the formulas in the used range sheet.AllocatedRange.IsFormulaHidden = true; //Protect the worksheet with password sheet.Protect("123"); //Save the file workbook.SaveToFile("HideFormulas.xlsx", ExcelVersion.Version2013); } } }
Screenshot:
Allow users to edit ranges for the protected Excel worksheet in C#
2017-02-08 06:59:17 Written by support iceblueSpire.XLS supports to protect the whole excel workbook and specified worksheet with password. When we deal with the protected worksheet, sometimes we need to allow users to edit some specified ranges of the excel worksheet. This article will focus on demonstrating how to use the AddAllowEditRange method offered by Spire.XLS to set the specified range on a protected worksheet to be editable by users.
Step 1: Initialize an instance of Workbook and load the document from file.
Workbook workbook = new Workbook(); workbook.LoadFromFile("Sample.xlsx");
Step 2: Get the first worksheet from the workbook.
Worksheet sheet = workbook.Worksheets[0];
Step 3: Define the specified ranges of Excel to allow users to edit while sheet is protected.
sheet.AddAllowEditRange("AAA", sheet.Range["C2:D8"], "");
Step 4: Protect the worksheet.
sheet.Protect("AAA", SheetProtectionType.All);
Step 5: Save the document to file.
workbook.SaveToFile("AllowEditRange.xlsx", ExcelVersion.Version2010);
Effective screenshot of Allow users to edit ranges:
Full codes:
using Spire.Xls; namespace EditRanges { class Program { static void Main(string[] args) { Workbook workbook = new Workbook(); workbook.LoadFromFile("Sample.xlsx"); Worksheet sheet = workbook.Worksheets[0]; sheet.AddAllowEditRange("AAA", sheet.Range["C2:D8"], ""); sheet.Protect("AAA", SheetProtectionType.All); workbook.SaveToFile("AllowEditRange.xlsx", ExcelVersion.Version2010); } } }
Remove or Reset Password of Encrypted Workbook in C#, VB.NET
2017-01-13 06:39:25 Written by support iceblueUsing Spire.XLS, the password of an encrypted workbook can be removed or modified in case you know the open password. This article presents how to load a password protected Excel workbook, remove the protection or reset the password and then save the changes to the original file.
Step 1: Initialize an instance of Workbook class.
Workbook wb = new Workbook();
Step 2: Specify the open password and then load the encrypted Excel file.
wb.OpenPassword = "oldpassword"; wb.LoadFromFile(@"C:\Users\Administrator\Desktop\Encrypted.xlsx");
Step 3: Remove the password protection with UnProtect() method or reset the password by Protect() method.
//unprotect workbook wb.UnProtect(); //reset password wb.Protect("newpassword");
Step 4: Save the changes to file.
wb.SaveToFile(@"C:\Users\Administrator\Desktop\Encrypted.xlsx, ExcelVersion.Version2010");
Full Code:
using Spire.Xls; namespace RemovePassword { class Program { static void Main(string[] args) { Workbook wb = new Workbook(); wb.OpenPassword = "oldpassword"; wb.LoadFromFile(@"C:\Users\Administrator\Desktop\Encrypted.xlsx"); ////unprotect workbook //wb.UnProtect(); //reset password wb.Protect("newpassword"); wb.SaveToFile(@"C:\Users\Administrator\Desktop\Encrypted.xlsx", ExcelVersion.Version2010); } } }
Imports Spire.Xls Namespace RemovePassword Class Program Private Shared Sub Main(args As String()) Dim wb As New Workbook() wb.OpenPassword = "oldpassword" wb.LoadFromFile("C:\Users\Administrator\Desktop\Encrypted.xlsx") '''/unprotect workbook 'wb.UnProtect(); 'reset password wb.Protect("newpassword") wb.SaveToFile("C:\Users\Administrator\Desktop\Encrypted.xlsx", ExcelVersion.Version2010) End Sub End Class End Namespace
Detect if an Excel Workbook is Password Protected in C#, VB.NET
2017-01-09 03:49:03 Written by support iceblueSpire.XLS provides a class named Workbook that represents an Excel workbook. This class contains a method named IsPasswordProtected(string fileName) which returns a boolean value. If the value is true, means the workbook is encrypted with password, otherwise it's not.
This is an Excel workbook protected with password:
Now refer below code to detect if the Excel workbook is password protected:
using System; using Spire.Xls; namespace Detect_if_workbook_is_password_protected { class Program { static void Main(string[] args) { string fileName = "E:\\Program Files\\Sample.xlsx"; //Detect if the Excel workbook is password protected. bool value = Workbook.IsPasswordProtected(fileName); Console.WriteLine(value); Console.ReadKey(); } } }
Imports Spire.Xls Namespace Detect_if_workbook_is_password_protected Class Program Private Shared Sub Main(args As String()) Dim fileName As String = "E:\Program Files\Sample.xlsx" 'Detect if the Excel workbook is password protected. Dim value As Boolean = Workbook.IsPasswordProtected(fileName) Console.WriteLine(value) Console.ReadKey() End Sub End Class End Namespace
After running the project, we get the Output that shows the workbook is password protected:
When creating an Excel worksheet, you may enter some data or formulas that you don't wish other users to modify. Locking the corresponding cells can be essential to maintain the integrity of the data and formulas. In this article, you will learn how to lock specific cells in Excel in C# and VB.NET using Spire.XLS for .NET library.
Install Spire.XLS for .NET
To begin with, you need to add the DLL files included in the Spire.XLS for .NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.XLS
Lock Specific Cells in Excel in C# and VB.NET
Normally, the locked option is enabled for all cells in a worksheet. Therefore, before locking a cell or range of cells, all cells must be unlocked. Keep in mind that locking cells doesn’t take effect until the worksheet is protected.
The following are the main steps to lock cells in Excel:
- Create an instance of Workbook class.
- Load the Excel file using Workbook.LoadFromFile() method.
- Get the desired worksheet using Workbook.Worksheet[sheetIndex] property.
- Access the used range in the worksheet and then unlock all the cells in the range by setting the CellRange.Style.Locked property as false.
- Access specific cells and then lock them by setting the CellRange.Style.Locked property as true.
- Protect the worksheet using XlsWorksheetBase.Protect() method.
- Save the result file using Workbook.SaveToFile() method.
- C#
- VB.NET
using Spire.Xls; namespace LockCells { class Program { static void Main(string[] args) { //Create a Workbook instance Workbook workbook = new Workbook(); //Load an Excel file workbook.LoadFromFile("Input.xlsx"); //Get the first worksheet Worksheet sheet = workbook.Worksheets[0]; //Unlock all cells in the used range of the worksheet CellRange usedRange = sheet.Range; usedRange.Style.Locked = false; //Lock specific cells CellRange cells = sheet.Range["A1:C3"]; cells.Style.Locked = true; //Protect the worksheet with password sheet.Protect("123456", SheetProtectionType.All); //Save the result file workbook.SaveToFile("LockCells.xlsx", ExcelVersion.Version2016); } } }
Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
Why Decrypt Excel Worksheet?
To protect our Excel file data information, we can encrypt Excel worksheet by setting password. But we may sometimes forget the password and we can't read the excel data information neither. So, if this happens we need decrypt Excel worksheet. It’s not easy to decrypt Excel Worksheet which has been encrypted because the reason why we encrypt it is to prevent it from reading by people without password. And now, we do not have password.
How to Use C#/VB.NET to Decrypt Excel Worksheet?
Spire.XLS for .NET, a .NET Excel component which enables .NET applications to fast generate, read, write and modify Excel document without Microsoft Office Excel Automation can help us decrypt Excel worksheet by using C#/VB.NET.
Spire.XLS for .NET presents a very easy solution for developers/programmers decrypting Excel worksheet. We just need sheet.Unprotect( "password" ) method and normal encrypted excel worksheet can be decrypted.
Download Spire.XLS for .NET (or Spire.Office) with .NET framework 2.0 (or above) together. The sample code below will show you how to use C#/VB.NET decrypt Excel worksheet through Spire.XLS for .NET.
using Spire.Xls; namespace DescryptWorksheet { class Program { static void Main(string[] args) { Workbook workbook = new Workbook(); workbook.LoadFromFile("test.xls"); Worksheet sheet = workbook.Worksheets[0]; sheet.Unprotect("password"); workbook.SaveToFile("result.xls", ExcelVersion.Version97to2003); } } }
Spire.XLS allows users to operate Excel document directly such as save to stream, save as web response, copy, lock/unlock worksheet, set up workbook properties, etc. As a professional .NET Excel component, it owns the ability of inserting content into Excel document, formatting cells and converting Excel documents to popular office file formats. Spire.XLS for .NET supports Excel 97-2003, Excel 2007 and Excel 2010.
When sharing Excel files with other people or sending files out of your organization, you may want to protect sensitive data from being changed, moved, or deleted. The easiest way to prevent accidental or deliberate changes in the contents is to restrict editing on a worksheet or password protect an entire workbook. In this article, you will learn how to protect and unprotect a workbook or a worksheet in C# and VB.NET using Spire.XLS for .NET.
- Password Protect an Entire Workbook
- Protect a Worksheet with a Specific Protection Type
- Allow Users to Edit Ranges in a Protected Worksheet
- Lock Specific Cells in a Worksheet
- Unprotect a Password Protected Worksheet
- Remove or Reset Password of an Encrypted Workbook
Install Spire.XLS for .NET
To begin with, you need to add the DLL files included in the Spire.XLS for .NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.XLS
Password Protect an Entire Workbook in C# and VB.NET
By encrypting an Excel document with a password, you ensure that only you and authorized individuals can read or edit it. The following are the steps to password protect a workbook using Spire.XLS for .NET.
- Create a Workbook object.
- Load an Excel file using Workbook.LoadFromFile() method.
- Protect the workbook using a password using Workbook.Protect() method.
- Save the workbook to another Excel file using Workbook.SaveToFile() method.
- C#
- VB.NET
using Spire.Xls; namespace PasswordProtectWorkbook { class Program { static void Main(string[] args) { //Create a Workbook object Workbook workbook = new Workbook(); //Load an Excel file workbook.LoadFromFile(@"C:\Users\Administrator\Desktop\sample.xlsx"); //Protect workbook with a password workbook.Protect("psd-123"); //Save the workbook to another Excel file workbook.SaveToFile("Encrypted.xlsx", ExcelVersion.Version2016); } } }
Protect a Worksheet with a Specific Protection Type in C# and VB.NET
If you wish to grant people permission to read your Excel document but restrict the types of modifications they are allowed to make on a worksheet, you can protect the worksheet with a specific protection type. The table below lists a variety of pre-defined protection types under the SheetProtectionType enumeration.
Protection Type | Allow users to |
Content | Modify or insert content. |
DeletingColumns | Delete columns. |
DeletingRows | Delete rows. |
Filtering | Set filters. |
FormattingCells | Format cells. |
FormattingColumns | Format columns. |
FormattingRows | Format rows. |
InsertingColumns | Insert columns. |
InsertingRows | Insert rows. |
InsertingHyperlinks | Insert hyperlinks . |
LockedCells | Select locked cells. |
UnlockedCells | Select unlocked cells. |
Objects | Modify drawing objects. |
Scenarios | Modify saved scenarios. |
Sorting | Sort data. |
UsingPivotTables | Use pivot table and pivot chart. |
All | Do any operations listed above on the protected worksheet. |
None | Do nothing on the protected worksheet. |
The following are the steps to protect a worksheet with a specific protection type using Spire.XLS for .NET.
- Create a Workbook object.
- Load an Excel file using Workbook.LoadFromFile() method.
- Get a specific worksheet through Workbook.Worksheets[index] property.
- Protect the worksheet with a protection type using Worksheet.Protect(string password, SheetProtectionType options) method.
- Save the workbook to another Excel file using Workbook.SaveToFile() method.
- C#
- VB.NET
using Spire.Xls; namespace ProtectWorksheetWithSpecificProtectionType { class Program { static void Main(string[] args) { //Create a Workbook object Workbook workbook = new Workbook(); //Load an Excel file workbook.LoadFromFile(@"C:\Users\Administrator\Desktop\sample.xlsx"); //Get a specific worksheet Worksheet worksheet = workbook.Worksheets[0]; //Protect the worksheet with the permission password and the specific protect type worksheet.Protect("psd-permission", SheetProtectionType.None); //Save the workbook to another Excel file workbook.SaveToFile("ProtectWorksheet.xlsx", ExcelVersion.Version2016); } } }
Allow Users to Edit Ranges in a Protected Worksheet in C# and VB.NET
In certain cases, you may need to allow users to be able to edit selected ranges in a protected worksheet. The following steps demonstrate how to.
- Create a Workbook object.
- Load an Excel file using Workbook.LoadFromFile() method.
- Get a specific worksheet through Workbook.Worksheets[index] property.
- Specify editable cell ranges using Worksheet.AddAllowEditRange() method.
- Protect the worksheet with a protection type using Worksheet.Protect(string password, SheetProtectionType options) method.
- Save the workbook to another Excel file using Workbook.SaveToFile() method.
- C#
- VB.NET
using Spire.Xls; namespace AllowEditRanges { class Program { static void Main(string[] args) { //Create a Workbook object Workbook workbook = new Workbook(); //Load an Excel file workbook.LoadFromFile(@"C:\Users\Administrator\Desktop\sample.xlsx"); //Get the first worksheet Worksheet sheet = workbook.Worksheets[0]; //Add ranges that allow editing sheet.AddAllowEditRange("Range One", sheet.Range["A5:A6"]); sheet.AddAllowEditRange("Range Two", sheet.Range["A8:B11"]); //Protect the worksheet with a password and a protection type sheet.Protect("psd-permission", SheetProtectionType.All); //Save the workbook to another Excel file workbook.SaveToFile("AllowEditRange.xlsx", ExcelVersion.Version2016); } } }
Unprotect a Password Protected Worksheet in C# and VB.NET
To remove the protection of a password-protected worksheet, invoke the Worksheet.Unprotect() method and pass in the original password as a parameter. The detailed steps are as follows.
- Create a Workbook object.
- Load an Excel file using Workbook.LoadFromFile() method.
- Get a specific worksheet through Workbook.Worksheets[index] property.
- Remove the protection using Worksheet.Unprotect(string password) method.
- Save the workbook to another Excel file using Workbook.SaveToFile() method.
- C#
- VB.NET
using Spire.Xls; namespace UnprotectWorksheet { class Program { static void Main(string[] args) { //Create a Workbook object Workbook workbook = new Workbook(); //Load an Excel file containing protected worksheet workbook.LoadFromFile(@"C:\Users\Administrator\Desktop\ProtectedWorksheet.xlsx"); //Get the first worksheet Worksheet sheet = workbook.Worksheets[0]; //Unprotect the worksheet using the specified password sheet.Unprotect("psd-permission"); //Save the workbook to anther Excel file workbook.SaveToFile("UnprotectWorksheet.xlsx", ExcelVersion.Version2016); } } }
Remove or Reset Password of an Encrypted Workbook in C# and VB.NET
To remove or reset password of an encrypted workbook, you can use the Workbook.Unprotect() method and the Workbook.Protect() method, respectively. The following steps show you how to load an encrypted Excel document and delete or change the password of it.
- Create a Workbook object.
- Specify the open password through Workbook.OpenPassword property.
- Load the encrypted Excel file using Workbook.LoadFromFile() method.
- Remove the encryption using Workbook.Unprotect() method. Or change the password using Workbook.Protect() method.
- Save the workbook to another Excel file using Workbook.SaveToFile() method.
- C#
- VB.NET
using Spire.Xls; namespace RemoveOrResetPassword { class Program { static void Main(string[] args) { //Create a Workbook object Workbook workbook = new Workbook(); //Specify the open password workbook.OpenPassword = "psd-123"; //Load an encrypted Excel file workbook.LoadFromFile(@"C:\Users\Administrator\Desktop\Encrypted.xlsx"); //Unprotect workbook workbook.UnProtect(); //Reset password //workbook.Protect("newpassword"); //Save the workbook to another Excel file workbook.SaveToFile("Unprotect.xlsx", ExcelVersion.Version2016); } } }
Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
The most important reason that people lock worksheet when perform tasks in Excel is to protect the original Excel file from editing or modifying by other people. Through Microsoft Excel, you can set the entire Excel worksheet by setting its property as Read Only or just set partial region area cells as Read Only via protecting worksheet. While how to lock worksheet with C#, VB.NET will be the core topic in this section.
Spire.XLS for .NET, as a fast and reliable excel component, enables you to lock your worksheet by setting Worksheet class property: Worksheet.Range.Style.Locked = true. By this component, you can lock any worksheet that you need. In this solution, worksheet one and worksheet two are locked as you view in below picture:
Now, before the detail code, you have to add Spire.Xls dll by download Spire.XLS for .NET.
using Spire.Xls; namespace lock_excel_worksheet { class Program { static void Main(string[] args) { Workbook workbook = new Workbook(); workbook.LoadFromFile(@"..\lock worksheet.xls"); workbook.Worksheets[0].Range.Style.Locked = true; workbook.Worksheets[1].Range.Style.Locked = true; workbook.Worksheets[0].Protect("", SheetProtectionType.All); workbook.Worksheets[1].Protect("", SheetProtectionType.All); workbook.SaveToFile("result.xls",ExcelVersion.Version97to2003); } } }
Imports Spire.Xls Namespace lock_excel_worksheet Class Program Private Shared Sub Main(ByVal args() As String) Dim workbook As Workbook = New Workbook workbook.LoadFromFile("..\lock worksheet.xls") workbook.Worksheets(0).Range.Style.Locked = true workbook.Worksheets(1).Range.Style.Locked = true workbook.Worksheets(0).Protect("", SheetProtectionType.All) workbook.Worksheets(1).Protect("", SheetProtectionType.All) workbook.SaveToFile("result.xls",ExcelVersion.Version97to2003) End Sub End Class End Namespace
Spire.XLS allows user to operate Excel document directly such as save to stream, save as web response, copy, lock/unlock worksheet, set up workbook properties, etc. As a professional .NET/Silverlight Excel component, it owns the ability of inserting content into Excel document, formatting cells and converting Excel documents to popular office file formats. Spire.XLS for .NET supports Excel 97-2003, Excel 2007 and Excel 2010.
This section aims at providing developers a solution to unlock sheet in Excel workbook with C#, VB.NET via this Excel library Spire.XLS for .NET.
Spire.XLS for .NET enables you to unlock any sheet in Excel file only by one line of key code: Spire.Xls.Worksheet.Unprotect(string password); Besides, as an MS Excel component, Spire.XLS for .NET also enables you to create, read and handle Excel files with fast speed. Below is an Excel file with protected worksheets which will be unlocked in my task.
Since you will use Spire.XLS for .NET, you have to download Spire.XLS for .NET and install it on system. When you create your project, please do not forget to add Spire.XLS.dll as reference from Bin folder. The default path is "..\Spire.XLS\Bin\NET4.0\Spire.XLS.dll". Please note that Spire.XLS for .NET supports .NET Framework 2.0 and above. Here is the whole code for unlocking Excel sheet:
namespace UnlockExcelSheet { class Program { static void Main(string[] args) { //initialize an instance of Workbook Workbook workbook = new Workbook(); //Load an Excel file with protected worksheet workbook.LoadFromFile(@"..\Unlock Excel Worksheet.xlsx"); //get the first worksheet Worksheet sheet = workbook.Worksheets[0]; //Unprotect worksheet sheet.Unprotect("iceblue"); //Save the file workbook.SaveToFile("Sample.xlsx",ExcelVersion.Version2010); //Launch the file System.Diagnostics.Process.Start("Sample.xlsx"); } } }
Namespace UnlockExcelSheet Class Program Private Shared Sub Main(args As String()) 'initialize an instance of Workbook Dim workbook As New Workbook() 'Load an Excel file with protected worksheet workbook.LoadFromFile("..\Unlock Excel Worksheet.xlsx") 'get the first worksheet Dim sheet As Worksheet = workbook.Worksheets(0) 'Unprotect worksheet sheet.Unprotect("iceblue") 'Save the file workbook.SaveToFile("Sample.xlsx",ExcelVersion.Version2010) 'Launch the file System.Diagnostics.Process.Start("Sample.xlsx") End Sub End Class End Namespace
After executing above code, you can see that the protected worksheet in the original Excel file has been unlocked, we can edit it also. Please see following image.
In this section, I have introduced the solution to unlock any sheet in Excel file via Spire.XLS for .NET. I hope it can help you. If you have any questions, feedbacks and advice, you can put them on E-iceblue Forum. We will promise a prompt reply.