Syncfusion AI Assistant

How can I help you?

Getting Started with JavaScript Spreadsheet control

27 Apr 20268 minutes to read

This section explains the steps to create a simple Syncfusion® JavaScript Spreadsheet control in a JavaScript application.

Create a JavaScript application

Create a folder named spreadsheet-app with index.html and index.js files.

Your application structure should look like this:

spreadsheet-app/
├── index.html
├── index.js

Add Syncfusion® Spreadsheet resources

Add the required Syncfusion® Spreadsheet style and script references to the index.html file using one of the following methods:

Create a resources folder under spreadsheet-app, and then copy the required script and style files from the Spreadsheet Editor SDK build into it.

...
<head>
    <!-- Spreadsheet dependency styles -->
    <link href="resources/base/styles/tailwind3.css" rel="stylesheet" type="text/css" />
    <link href="resources/inputs/styles/tailwind3.css" rel="stylesheet" type="text/css" />
    <link href="resources/buttons/styles/tailwind3.css" rel="stylesheet" type="text/css" />
    <link href="resources/splitbuttons/styles/tailwind3.css" rel="stylesheet" type="text/css" />
    <link href="resources/lists/styles/tailwind3.css" rel="stylesheet" type="text/css" />
    <link href="resources/navigations/styles/tailwind3.css" rel="stylesheet" type="text/css" />
    <link href="resources/popups/styles/tailwind3.css" rel="stylesheet" type="text/css" />
    <link href="resources/dropdowns/styles/tailwind3.css" rel="stylesheet" type="text/css" />
    <link href="resources/grids/styles/tailwind3.css" rel="stylesheet" type="text/css" />
    <!-- Spreadsheet styles -->
    <link href="resources/spreadsheet/styles/tailwind3.css" rel="stylesheet" type="text/css" />
    <!-- Spreadsheet dependency scripts -->
    <script src="resources/scripts/ej2-base.min.js" type="text/javascript"></script>
    <script src="resources/scripts/ej2-buttons.min.js" type="text/javascript"></script>
    <script src="resources/scripts/ej2-popups.min.js" type="text/javascript"></script>
    <script src="resources/scripts/ej2-splitbuttons.min.js" type="text/javascript"></script>
    <script src="resources/scripts/ej2-inputs.min.js" type="text/javascript"></script>
    <script src="resources/scripts/ej2-lists.min.js" type="text/javascript"></script>
    <script src="resources/scripts/ej2-data.min.js" type="text/javascript"></script>
    <script src="resources/scripts/ej2-dropdowns.min.js" type="text/javascript"></script>
    <script src="resources/scripts/ej2-navigations.min.js" type="text/javascript"></script>
    <script src="resources/scripts/ej2-excel-export.min.js" type="text/javascript"></script>
    <script src="resources/scripts/ej2-pdf-export.min.js" type="text/javascript"></script>
    <script src="resources/scripts/ej2-calendars.min.js" type="text/javascript"></script>
    <script src="resources/scripts/ej2-compression.min.js" type="text/javascript"></script>
    <script src="resources/scripts/ej2-file-utils.min.js" type="text/javascript"></script>
    <script src="resources/scripts/ej2-grids.min.js" type="text/javascript"></script>
    <script src="resources/scripts/ej2-svg-base.min.js" type="text/javascript"></script>
    <script src="resources/scripts/ej2-charts.min.js" type="text/javascript"></script>
    <!-- Spreadsheet scripts -->
    <script src="resources/scripts/ej2-spreadsheet.min.js" type="text/javascript"></script>
</head>
...

Note: To learn more about other ways to load themes or scripts, see the Themes topic and CRG documentation.

Add the Syncfusion® Spreadsheet control

Add a container element for the Spreadsheet control in the index.html file and then initialize the control in the index.js file.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Syncfusion JavaScript Spreadsheet</title>
    <!-- Add your style references here -->
</head>
<body>
    <!-- Element which will render as Spreadsheet -->
    <div id="element"></div>
    <script src="index.js" type="text/javascript"></script>
</body>
</html>
// Initialize the Spreadsheet control
var spreadsheet = new ej.spreadsheet.Spreadsheet({
    openUrl: 'https://document.syncfusion.com/web-services/spreadsheet-editor/api/spreadsheet/open',
    saveUrl: 'https://document.syncfusion.com/web-services/spreadsheet-editor/api/spreadsheet/save'
});

// Render the initialized Spreadsheet
spreadsheet.appendTo('#element');

Note: The openUrl and saveUrl properties are used to connect the Spreadsheet control to a server-side service for Excel import and export operations. For development and production use, we recommend configuring your own local or hosted service instead of relying on demo endpoints. For more information, refer to the link.

Run the application

Now, open the index.html file in a web browser to render the JavaScript Spreadsheet editor.

Use the following live preview to explore the Spreadsheet control.

See also