| 
									
										
										
										
											2022-05-16 03:26:04 +00:00
										 |  |  | --- | 
					
						
							| 
									
										
										
										
											2022-08-24 23:48:22 +00:00
										 |  |  | pagination_prev: getting-started/index | 
					
						
							| 
									
										
										
										
											2023-07-26 20:18:07 +00:00
										 |  |  | pagination_next: getting-started/examples/index | 
					
						
							| 
									
										
										
										
											2022-08-31 06:46:03 +00:00
										 |  |  | sidebar_position: 6 | 
					
						
							| 
									
										
										
										
											2022-05-16 03:26:04 +00:00
										 |  |  | sidebar_custom_props: | 
					
						
							|  |  |  |   summary: Import ECMAScript Modules and TypeScript definitions | 
					
						
							|  |  |  | --- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import current from '/version.js'; | 
					
						
							| 
									
										
										
										
											2022-11-08 23:16:40 +00:00
										 |  |  | import Tabs from '@theme/Tabs'; | 
					
						
							|  |  |  | import TabItem from '@theme/TabItem'; | 
					
						
							| 
									
										
										
										
											2023-05-07 13:58:36 +00:00
										 |  |  | import CodeBlock from '@theme/CodeBlock'; | 
					
						
							| 
									
										
										
										
											2022-05-16 03:26:04 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Deno
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-08 23:16:40 +00:00
										 |  |  | Module scripts and type definitions are available at <https://cdn.sheetjs.com/>. | 
					
						
							| 
									
										
										
										
											2022-05-16 03:26:04 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | Using the URL imports, `deno run` will automatically download scripts and types: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-07 13:58:36 +00:00
										 |  |  | <CodeBlock language="ts">{`\ | 
					
						
							| 
									
										
										
										
											2022-05-16 03:26:04 +00:00
										 |  |  | // @deno-types="https://cdn.sheetjs.com/xlsx-${current}/package/types/index.d.ts" | 
					
						
							|  |  |  | import * as XLSX from 'https://cdn.sheetjs.com/xlsx-${current}/package/xlsx.mjs';`} | 
					
						
							| 
									
										
										
										
											2023-05-07 13:58:36 +00:00
										 |  |  | </CodeBlock> | 
					
						
							| 
									
										
										
										
											2022-05-16 03:26:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-05 22:43:44 +00:00
										 |  |  | The `@deno-types` comment instructs Deno to use the type definitions. | 
					
						
							| 
									
										
										
										
											2022-05-16 03:26:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-08 23:16:40 +00:00
										 |  |  | :::caution Deno support is considered experimental. | 
					
						
							| 
									
										
										
										
											2022-07-06 05:38:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-08 23:16:40 +00:00
										 |  |  | Great open source software grows with user tests and reports. Any issues should | 
					
						
							|  |  |  | be reported to the Deno project for further diagnosis. | 
					
						
							| 
									
										
										
										
											2022-07-06 05:38:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | ::: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-25 09:36:58 +00:00
										 |  |  | :::tip pass | 
					
						
							| 
									
										
										
										
											2023-04-27 09:12:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | [Watch the repo](https://git.sheetjs.com/SheetJS/sheetjs) or subscribe to the | 
					
						
							|  |  |  | [RSS feed](https://git.sheetjs.com/sheetjs/sheetjs/tags.rss) to be notified when | 
					
						
							|  |  |  | new versions are released! | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ::: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-26 19:21:53 +00:00
										 |  |  | ## Encoding support
 | 
					
						
							| 
									
										
										
										
											2022-06-05 22:43:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-26 19:21:53 +00:00
										 |  |  | If Encoding support is required, `cpexcel.full.mjs` must be manually imported: | 
					
						
							| 
									
										
										
										
											2022-05-16 03:26:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-07 13:58:36 +00:00
										 |  |  | <CodeBlock language="ts">{`\ | 
					
						
							| 
									
										
										
										
											2022-05-16 03:26:04 +00:00
										 |  |  | /* load the codepage support library for extended support with older formats  */ | 
					
						
							|  |  |  | import * as cptable from 'https://cdn.sheetjs.com/xlsx-${current}/package/dist/cpexcel.full.mjs'; | 
					
						
							|  |  |  | XLSX.set_cptable(cptable);`} | 
					
						
							| 
									
										
										
										
											2023-05-07 13:58:36 +00:00
										 |  |  | </CodeBlock> | 
					
						
							| 
									
										
										
										
											2022-11-08 23:16:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | ## Upgrade Notes
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Upgrading to the latest version involves changing the import URLs.  The import | 
					
						
							|  |  |  | and the types URLs should be updated at the same time: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-07 13:58:36 +00:00
										 |  |  | <CodeBlock language="diff">{`\ | 
					
						
							| 
									
										
										
										
											2022-11-08 23:16:40 +00:00
										 |  |  | -// @deno-types="https://cdn.sheetjs.com/xlsx-0.18.3/package/types/index.d.ts" | 
					
						
							|  |  |  | +// @deno-types="https://cdn.sheetjs.com/xlsx-${current}/package/types/index.d.ts" | 
					
						
							| 
									
										
										
										
											2023-05-07 13:58:36 +00:00
										 |  |  | \n\ | 
					
						
							| 
									
										
										
										
											2022-11-08 23:16:40 +00:00
										 |  |  | -import * as XLSX from 'https://cdn.sheetjs.com/xlsx-0.18.3/package/xlsx.mjs'; | 
					
						
							|  |  |  | +import * as XLSX from 'https://cdn.sheetjs.com/xlsx-${current}/package/xlsx.mjs'; | 
					
						
							| 
									
										
										
										
											2023-05-07 13:58:36 +00:00
										 |  |  | \n\ | 
					
						
							| 
									
										
										
										
											2022-11-08 23:16:40 +00:00
										 |  |  | -import * as cptable from 'https://cdn.sheetjs.com/xlsx-0.18.3/package/dist/cpexcel.full.mjs'; | 
					
						
							|  |  |  | +import * as cptable from 'https://cdn.sheetjs.com/xlsx-${current}/package/dist/cpexcel.full.mjs'; | 
					
						
							|  |  |  | `} | 
					
						
							| 
									
										
										
										
											2023-05-07 13:58:36 +00:00
										 |  |  | </CodeBlock> | 
					
						
							| 
									
										
										
										
											2022-11-08 23:16:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #### Deno Registry
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | :::warning | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The official Deno registry is out of date.  This is a registry bug. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <https://cdn.sheetjs.com/> is the authoritative source for SheetJS scripts. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ::: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-13 20:45:13 +00:00
										 |  |  | Applications using the Deno registry can migrate by changing the URLs.  After | 
					
						
							| 
									
										
										
										
											2023-07-06 07:21:41 +00:00
										 |  |  | migrating, scripts can be updated by changing the version number. | 
					
						
							| 
									
										
										
										
											2022-11-08 23:16:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | <Tabs> | 
					
						
							|  |  |  |   <TabItem value="v" label="URL with version"> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The SheetJS CDN version has no `v`.  For example, `v0.18.3` maps to `0.18.3`: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```diff | 
					
						
							|  |  |  | -// @deno-types="https://deno.land/x/sheetjs@v0.18.3/types/index.d.ts" | 
					
						
							|  |  |  | +// @deno-types="https://cdn.sheetjs.com/xlsx-0.18.3/package/types/index.d.ts" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | -import * as XLSX from 'https://deno.land/x/sheetjs@v0.18.3/xlsx.mjs'; | 
					
						
							|  |  |  | +import * as XLSX from 'https://cdn.sheetjs.com/xlsx-0.18.3/package/xlsx.mjs'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | -import * as cptable from 'https://deno.land/x/sheetjs@v0.18.3/dist/cpexcel.full.mjs'; | 
					
						
							|  |  |  | +import * as cptable from 'https://cdn.sheetjs.com/xlsx-0.18.3/package/dist/cpexcel.full.mjs'; | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   </TabItem> | 
					
						
							|  |  |  |   <TabItem value="nov" label="URL without version"> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Version-less imports (`https://deno.land/x/sheetjs/xlsx.mjs`) map to `0.18.3`: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```diff | 
					
						
							|  |  |  | -// @deno-types="https://deno.land/x/sheetjs/types/index.d.ts" | 
					
						
							|  |  |  | +// @deno-types="https://cdn.sheetjs.com/xlsx-0.18.3/package/types/index.d.ts" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | -import * as XLSX from 'https://deno.land/x/sheetjs/xlsx.mjs'; | 
					
						
							|  |  |  | +import * as XLSX from 'https://cdn.sheetjs.com/xlsx-0.18.3/package/xlsx.mjs'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | -import * as cptable from 'https://deno.land/x/sheetjs/dist/cpexcel.full.mjs'; | 
					
						
							|  |  |  | +import * as cptable from 'https://cdn.sheetjs.com/xlsx-0.18.3/package/dist/cpexcel.full.mjs'; | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   </TabItem> | 
					
						
							|  |  |  | </Tabs> |