Open, Save and Protect Workbook

Spread.Services Documentation
Open, Save and Protect Workbook
Collapse All Expand All

Spread.Services Documentation > Developer's Guide > Customize User Interaction > Manage Workbook > Open, Save and Protect Workbook

Once you create a workbook, you can open the workbook to make modifications, save the changes back to the workbook and protect it with a password to ensure security.

This topic includes the following tasks:

- Open a workbook
- Save a workbook
- Protect a workbook

### Open a workbook

You can open an existing workbook by calling the Open method of the Workbook class.

| Note: While opening the workbook, you can check whether it is password protected or not by using the IsEncryptedFile method of the Workbook class. If your workbook is password protected, you would need to provide a password everytime you open it.

Refer to the following example code to open a workbook.

C# | Copy Code
--- | ---

    // Open the existing Excel file
    workbook.Open("createWorkbook.xlsx");

### Save a workbook

You can save the changes made in the existing workbook by calling the Save method of the Workbook class.

Refer to the following example code to save your workbook.

C# | Copy Code
--- | ---

    // Save the Excel file
    workbook.Save("createWorkbook.xlsx");

### Protect a workbook

Spread.Services provides you extensive security in terms of enabling users to protect a workbook by encrypting it with a password. This is important when you have a business critical workbook containing sensitive data that you don't want to share with everyone.

Refer to the following example code to make your worksheet password protected.

C# | Copy Code
--- | ---

    // Save the Excel file and protect it using password.
    workbook.Save("createWorkbook.xlsx", "123456");

See Also
Cut or Copy Across Sheets

Copyright © GrapeCity, inc. All rights reserved.