#ejSpreadsheet Services
##Importing Service
Description
To import excel file in Spreadsheet by using import service.
Note: allowImport must be true while using this property.
URL
http://js.syncfusion.com/demos/ejservices/api/JSXLExport/Import
Parameter
Name | DataType | Description |
---|---|---|
File | HttpPostedFileBase | To specify the excel file. |
Url | String | To specify the URL of the online files which is imported to the spreadsheet. |
AllowSheetOnDemand | Bool | To specify the a value indicating whether the sheet on demand is enable or not. |
Password | String | To specify the password for the protected import file. |
Request
<div id=”Spreadsheet”></div>
<script>
var Spreadsheet = $("#Spreadsheet").data("ejSpreadsheet");// Spreadsheet Object
var importSettings = Spreadsheet.model.importSettings;
importSettings.allowImport = true;
importSettings.importMapper = "http://js.syncfusion.com/demos/ejservices/api/JSXLExport/Import";
importSettings.importUrl = "http://mvc.syncfusion.com/Spreadsheet/LargeData.xlsx";
importSettings.allowSheetOnDemand = false;
importSettings.password = "";
Spreadsheet.import({ url:importSettings.importUrl, allowSheetOnDemand:importSettings.allowSheetOnDemand });
</script>
###Response (JSON):
Excel file document imported in spreadsheet.
##Exporting services
Description
The following exporting options available in Spreadsheet.
- Excel Export
- CSV Export
- PDF Export
Note: allowExport must be true while using this property.
##Excel Export
Description
To export spreadsheet data as Excel document.
URL
http://js.syncfusion.com/demos/ejservices/api/JSXLExport/ExportToExcel
Parameter
Name | DataType | Description |
---|---|---|
type | Enum | To specify the type of the file to be downloaded (XLSX, XLS). |
Password | String | To set the password for the file to be downloaded |
Request
<div id=”Spreadsheet”></div>
<script>
var Spreadsheet = $("#Spreadsheet").data("ejSpreadsheet");// Spreadsheet Object
var exportSettings = Spreadsheet.model.exportSettings;
exportSettings.allowExporting = true;
exportSettings.excelUrl = "http://js.syncfusion.com/demos/ejservices/api/JSXLExport/ExportToExcel";
exportSettings.password = "";
Spreadsheet.XLExport.export("Excel");
</script>
###Response
####Code: 200
####Content-Type: application/octet-stream
####Response (XLSX,XLS):
Browser will prompt a dialog box to save the file (document).
##CSV Export
Description
To export spreadsheet data as CSV document.
URL
http://js.syncfusion.com/demos/ejservices/api/JSXLExport/ExportToCsv
Parameter
Name | DataType | Description |
---|---|---|
type | Enum | To specify the type of the file to be downloaded (CSV). |
Password | String | To set the password for the file to be downloaded |
Request
<div id=”Spreadsheet”></div>
<script>
var Spreadsheet = $("#Spreadsheet").data("ejSpreadsheet");// Spreadsheet Object
var exportSettings = Spreadsheet.model.exportSettings;
exportSettings.allowExporting = true;
exportSettings.excelUrl = "http://js.syncfusion.com/demos/ejservices/api/JSXLExport/ExportToCsv";
exportSettings.password = "";
Spreadsheet.XLExport.export("Csv");
</script>
###Response
####Code: 200
####Content-Type: application/octet-stream
####Response (CSV):
Browser will prompt a dialog box to save the file (document).
##PDF Export
Description
To export spreadsheet data as PDF document.
URL
http://js.syncfusion.com/demos/ejservices/api/JSXLExport/ExportToPdf
Parameter
Name | DataType | Description |
---|---|---|
type | Enum | To specify the type of the file to be downloaded (PDF). |
Password | String | To set the password for the file to be downloaded |
Request
<div id=”Spreadsheet”></div>
<script>
var Spreadsheet = $("#Spreadsheet").data("ejSpreadsheet");// Spreadsheet Object
var exportSettings = Spreadsheet.model.exportSettings;
exportSettings.allowExporting = true;
exportSettings.excelUrl = "http://js.syncfusion.com/demos/ejservices/api/JSXLExport/ExportToPdf";
exportSettings.password = "";
Spreadsheet.XLExport.export("Pdf");
</script>
###Response
####Code: 200
####Content-Type: application/octet-stream
####Response (PDF):
Browser will prompt a dialog box to save the file (document).