{"id":8335,"date":"2021-03-22T13:34:22","date_gmt":"2021-03-22T10:34:22","guid":{"rendered":"https:\/\/dhtmlx.com\/blog\/?p=8335"},"modified":"2026-06-30T17:11:21","modified_gmt":"2026-06-30T14:11:21","slug":"dhtmlx-spreadsheet-4-1-multiple-sheets","status":"publish","type":"post","link":"https:\/\/dhtmlx.com\/blog\/dhtmlx-spreadsheet-4-1-multiple-sheets\/","title":{"rendered":"DHTMLX Spreadsheet 4.1 with Multiple Sheets"},"content":{"rendered":"<p>The spring release of the DHTMLX <a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxSpreadsheet\/\" rel=\"noopener\" target=\"_blank\">JavaScript spreadsheet<\/a> library brings out new features essential for data analysis and reporting in web applications. The update enables you to create and use multiple sheets and cross-reference between them. New methods, configuration options, and events delivered in v4.1 make it easy to fine-tune DHTMLX Spreadsheet and incorporate it into any web app. <\/p>\n<h5>Working with Multiple Sheets<\/h5>\n<p>Starting with v4.1, users can <a href=\"https:\/\/docs.dhtmlx.com\/spreadsheet\/work_with_sheets\/\" rel=\"noopener\" target=\"_blank\">create and manage<\/a> as many worksheets as they need. It is possible to add, rename, and remove sheets, switch between them and benefit from cross-referencing. <a href=\"https:\/\/docs.dhtmlx.com\/spreadsheet\/work_with_sheets\/#cross-references-between-sheets\" rel=\"noopener\" target=\"_blank\">Cross-referencing<\/a> allows you to combine data from different sheets and apply formulas referencing cells across an entire spreadsheet.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/03\/Spreadsheet-4.1.gif\" alt=\"DHTMLX Spreadsheet with multiple sheets\" width=\"900\" height=\"693\" class=\"aligncenter size-full wp-image-8355\" \/><a href=\"https:\/\/snippet.dhtmlx.com\/afxi1wvx\" rel=\"noopener\" target=\"_blank\">Check the sample ><\/a><\/p>\n<p>Working with several sheets is simple and intuitive due to a new context menu. If you right-click any worksheet tab, you will see the menu with the available options. Thus, you can quickly remove and rename sheets.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2021\/03\/Untitled-Project.gif\" alt=\"DHTMLX Spreadsheet Context Menu\" width=\"900\" height=\"694\" class=\"aligncenter size-full wp-image-8357\" \/><\/p>\n<h5>Managing Sheets via API<\/h5>\n<p>Setting up multiple sheets in DHTMLX Spreadsheet is easy as pie. The <a href=\"https:\/\/docs.dhtmlx.com\/spreadsheet\/api\/spreadsheet_multisheets_config\/\" rel=\"noopener\" target=\"_blank\"><strong>multiSheets<\/strong><\/a> configuration property is set to <em>true<\/em> by default. If you would like to disable it, you just need to specify its value to <em>false<\/em>.<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">var<\/span> spreadsheet <span class=\"sy0\">=<\/span> <span class=\"kw1\">new<\/span> dhx.<span class=\"me1\">Spreadsheet<\/span><span class=\"br0\">&#40;<\/span>document.<span class=\"me1\">body<\/span><span class=\"sy0\">,<\/span> <span class=\"br0\">&#123;<\/span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br \/>\n&nbsp; &nbsp; multiSheets<span class=\"sy0\">:<\/span> <span class=\"kw2\">false<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p>To <a href=\"https:\/\/docs.dhtmlx.com\/spreadsheet\/working_with_sheets\/\" rel=\"noopener\" target=\"_blank\">populate<\/a> your spreadsheet with data for multiple sheets, all you have to do is to pass the prepared data via the <strong>parse<\/strong> method. The data should contain an array with sheets objects and an object with styles applied to particular cells:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">var<\/span> styledData <span class=\"sy0\">=<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; styles<span class=\"sy0\">:<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; someclass<span class=\"sy0\">:<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; background<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;#F2F2F2&quot;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; color<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;#F57C00&quot;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; sheets <span class=\"sy0\">:<\/span> <span class=\"br0\">&#91;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/ create sheets with custom configurations (names and ids)<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;sheet 1&quot;<\/span><span class=\"sy0\">,<\/span> <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;sheet_1&quot;<\/span><span class=\"sy0\">,<\/span> <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data<span class=\"sy0\">:<\/span> <span class=\"br0\">&#91;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> cell<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;a1&quot;<\/span><span class=\"sy0\">,<\/span> value<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Country&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> cell<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;b1&quot;<\/span><span class=\"sy0\">,<\/span> value<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Product&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#93;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span> <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;sheet 2&quot;<\/span><span class=\"sy0\">,<\/span> <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; id<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;sheet_2&quot;<\/span><span class=\"sy0\">,<\/span> <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data<span class=\"sy0\">:<\/span> <span class=\"br0\">&#91;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> cell<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;a1&quot;<\/span><span class=\"sy0\">,<\/span> value<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Country&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> cell<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;b1&quot;<\/span><span class=\"sy0\">,<\/span> value<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Product&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#93;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/ create a sheet with the default configuration<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data<span class=\"sy0\">:<\/span> <span class=\"br0\">&#91;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> cell<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;a1&quot;<\/span><span class=\"sy0\">,<\/span> value<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Country&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#123;<\/span> cell<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;b1&quot;<\/span><span class=\"sy0\">,<\/span> value<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;Product&quot;<\/span> <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#93;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span> <br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#93;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp;<br \/>\nspreadsheet.<span class=\"me1\">parse<\/span><span class=\"br0\">&#40;<\/span>styledData<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p>A range of new API methods allows manipulating sheets programmatically. For example, the <strong>getActiveSheet<\/strong> method returns the active sheet, while the <strong>getSheets<\/strong> method returns all the sheets in the spreadsheet. The names of the <strong>addSheet<\/strong> and <strong>removeSheet<\/strong> methods speak for themselves. <\/p>\n<p>Please note that using these methods to manage multiple sheets is possible only if the <strong>multiSheets<\/strong> configuration option is enabled.<\/p>\n<h5>Listening to User Actions<\/h5>\n<p><a href=\"https:\/\/docs.dhtmlx.com\/spreadsheet\/api\/api_overview\/#spreadsheet-events\" rel=\"noopener\" target=\"_blank\">New events<\/a> introduced in v4.1 ensure the interactivity of DHTMLX Spreadsheet, hence enhanced user experience. They allow tracking such user actions as adding and removing sheets, renaming a sheet, and switching between sheets. There is a separate event for firing before and after a certain action occurs.<\/p>\n<h5>Other Updates<\/h5>\n<p>Another new feature delivered in v4.1 is the ability to get the formula of a cell via the <a href=\"https:\/\/docs.dhtmlx.com\/spreadsheet\/api\/spreadsheet_getformula_method\/\" rel=\"noopener\" target=\"_blank\"><strong>getFormula<\/strong><\/a> method. This method can return the formula from the active sheet as well as from any sheet specified as a parameter together with the id of the cell:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">var<\/span> formula <span class=\"sy0\">=<\/span> spreadsheet.<span class=\"me1\">getFormula<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;sheet1!B2&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p>Existing methods for getting and setting cell values, styles, and format, locking and unlocking cells, and checking their state are also updated. From now on, you can apply any of these methods to a cell from a particular sheet by adding the name of the required sheet before the cell id to the parameter of the method as the cell parameter.<\/p>\n<p>We invite you to test the <a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxSpreadsheet\/download.shtml\" rel=\"noopener\" target=\"_blank\">new v4.1 of DHTMLX Spreadsheet<\/a> free of charge during a 30-day trial period. <\/p>\n<p>Current clients can download the minor update from their <a href=\"https:\/\/dhtmlx.com\/clients\/\" rel=\"noopener\" target=\"_blank\">Client&#8217;s Area<\/a>.<\/p>\n<p>Meanwhile, we are looking forward to your feedback. Feel free to leave your comments in the discussion below or address your questions to our technical support team via email.<\/p>\n<h5>Related Materials:<\/h5>\n<ul>\n<li><a href=\"https:\/\/docs.dhtmlx.com\/spreadsheet\/whats_new\/\" rel=\"noopener\" target=\"_blank\">Full &#8220;What&#8217;s new&#8221; list<\/a><\/li>\n<li><a href=\"https:\/\/snippet.dhtmlx.com\/wux2b35b?tag=spreadsheet\" rel=\"noopener\" target=\"_blank\">Samples<\/a><\/li>\n<li><a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxSpreadsheet\/download.shtml\" rel=\"noopener\" target=\"_blank\">Free trial version<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The spring release of the DHTMLX JavaScript spreadsheet library brings out new features essential for data analysis and reporting in web applications. The update enables you to create and &#8230;<\/p>\n","protected":false},"author":101012,"featured_media":8363,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[70,1,38],"tags":[33,34],"class_list":["post-8335","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-releases","category-uncategorized","category-visible","tag-all-posts","tag-spreadsheet"],"_links":{"self":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/8335","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/users\/101012"}],"replies":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/comments?post=8335"}],"version-history":[{"count":12,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/8335\/revisions"}],"predecessor-version":[{"id":15758,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/8335\/revisions\/15758"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/media\/8363"}],"wp:attachment":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/media?parent=8335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/categories?post=8335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/tags?post=8335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}