Import and Export .xlsx Document

Spread.Services Documentation
Import and Export .xlsx Document
Collapse All Expand All

Spread.Services Documentation > Developer's Guide > Manage Data in Spread Component > Import and Export .xlsx Document

This section summarizes how Spread.Services handles the spreadsheet documents(.xlsx files).

When you create a workbook using Spread.Services and save it, you automatically export it to an external location or folder. When bringing an Excel file into Spread.Services (importing) and when saving Spread.Services files to an Excel format (exporting), most of the data can be imported or exported successfully. The intention of the import and export capability is to handle as much of the data and formatting of a spreadsheet as possible.

Refer to the following example code to import and export .xlsx document.

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

    //Create workbook and access its first worksheet
    Workbook workbook = new Workbook();
    IWorksheet worksheet = workbook.Worksheets[0];
    // Assigning value to range
    worksheet.Range["A3"].Value = 5;
    worksheet.Range["A2"].Value = 5;
    worksheet.Range["A1"].Value = 5;
    worksheet.Range["B1"].Value = 5;
    // Exporting Xlsx document
    workbook.Save("savingfile.xlsx");
    // Importing Xlsx document
    workbook.Open("Source.xlsx");

Copyright © GrapeCity, inc. All rights reserved.