Xlsx sử dụng định dạng ô json_to_sheet
Trình phân tích cú pháp và trình ghi cho các định dạng bảng tính khác nhau. Triển khai phòng sạch Pure-JS từ thông số kỹ thuật chính thức, tài liệu liên quan và tệp thử nghiệm. Nhấn mạnh vào tính mạnh mẽ của phân tích cú pháp và viết, khả năng tương thích tính năng đa định dạng với biểu diễn JS thống nhất và khả năng tương thích trình duyệt ES3/ES5 trở lại IE6 Show
Đây là phiên bản cộng đồng. Chúng tôi cũng cung cấp phiên bản chuyên nghiệp với các cải tiến về hiệu suất, các tính năng bổ sung như kiểu dáng và hỗ trợ chuyên dụng Phiên bản chuyên nghiệp Hỗ trợ thương mại Tài liệu kết xuất Trình diễn trong trình duyệt Mã nguồn Sự cố và Báo cáo lỗi Hỗ trợ định dạng tệp cho các định dạng dữ liệu bảng tính đã biết Biểu đồ các định dạng được hỗ trợ (bấm để hiển thị)Kiểm tra trình duyệt Mục lụcMở rộng để hiển thị Mục lục
Cài đặtTrong trình duyệt, chỉ cần thêm thẻ script <script lang="javascript" src="dist/xlsx.full.min.js">script>Tính khả dụng của CDN (nhấp để hiển thị)CDNURL if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */9https. // giải nén. com/xlsx/ #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */0https. // jsdelivr. com/gói/npm/xlsx #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */1http. //cdnjs. com/libraries/xlsx #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */2https. //bó. chạy/xlsx@latest?name=XLSX if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */9 cung cấp phiên bản mới nhất tại <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script> Với npm $ npm install xlsx với bower ________số 8 Trình diễn hệ sinh thái JSThư mục #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */4 bao gồm các dự án mẫu cho Framework và API
Bó và dụng cụ
Nền tảng và tích hợp
Các ví dụ khác được bao gồm trong showcase Mô-đun tùy chọnCác tính năng tùy chọn (bấm để hiển thị)Phiên bản nút tự động yêu cầu các mô-đun cho các tính năng bổ sung. Một số mô-đun này có kích thước khá lớn và chỉ cần thiết trong những trường hợp đặc biệt, vì vậy chúng không vận chuyển cùng với lõi. Để sử dụng trình duyệt, chúng phải được đưa vào trực tiếp #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */8 Một phiên bản thích hợp cho mỗi phụ thuộc được bao gồm trong thư mục dist/ Phiên bản một tệp hoàn chỉnh được tạo tại <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>13 Bản dựng mỏng hơn với hỗ trợ XLSX / HTML được tạo tại <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>14 Các bản dựng Webpack và Browserify bao gồm các mô-đun tùy chọn theo mặc định. Webpack có thể được cấu hình để loại bỏ hỗ trợ với <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>15 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */2 Khả năng tương thích ECMAScript 5Vì thư viện sử dụng các chức năng như <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>16, các trình duyệt cũ hơn yêu cầu các miếng chêm cung cấp các chức năng còn thiếu Để sử dụng miếng chêm, hãy thêm miếng chêm trước thẻ tập lệnh tải <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>17 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */5 Tập lệnh cũng bao gồm <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>18 và <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>19 để tải và lưu tệp trong Internet Explorer phiên bản 6-9. Tập lệnh <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>20 gói miếng chêm ở định dạng phù hợp với Photoshop và các sản phẩm Adobe khác Triết họcTriết học (bấm vào để hiển thị)Trước SheetJS, các API để xử lý tệp bảng tính có định dạng cụ thể. Các thư viện của bên thứ ba hỗ trợ một định dạng hoặc chúng liên quan đến một tập hợp các lớp riêng biệt cho từng loại tệp được hỗ trợ. Mặc dù XLSB đã được giới thiệu trong Excel 2007, nhưng không có gì ngoài SheetJS hoặc Excel hỗ trợ định dạng Để thúc đẩy chế độ xem không biết định dạng, js-xlsx bắt đầu từ một biểu diễn JS thuần túy mà chúng tôi gọi là "Định dạng bảng tính chung". Việc nhấn mạnh một biểu diễn đối tượng thống nhất cho phép các tính năng mới như chuyển đổi định dạng (đọc mẫu XLSX và lưu dưới dạng XLS) và loại bỏ sự lộn xộn của các lớp. Bằng cách trừu tượng hóa sự phức tạp của các định dạng khác nhau, các công cụ không cần lo lắng về loại tệp cụ thể Biểu diễn đối tượng đơn giản kết hợp với thực hành viết mã cẩn thận cho phép sử dụng các trường hợp trong các trình duyệt cũ hơn và trong các môi trường thay thế như ExtendScript và Web Worker. Việc sử dụng các tính năng mới nhất và tốt nhất luôn luôn hấp dẫn, nhưng chúng có xu hướng yêu cầu các phiên bản trình duyệt mới nhất, hạn chế khả năng sử dụng Các chức năng tiện ích nắm bắt các trường hợp sử dụng phổ biến như tạo các đối tượng JS hoặc HTML. Hầu hết các hoạt động đơn giản chỉ cần một vài dòng mã. Các hoạt động phức tạp hơn thường dễ thực hiện Excel đẩy định dạng XLSX làm mặc định bắt đầu từ Excel 2007. Tuy nhiên, có những định dạng khác với các thuộc tính hấp dẫn hơn. Ví dụ: định dạng XLSB về mặt tinh thần tương tự như XLSX nhưng các tệp thường có xu hướng chiếm ít hơn một nửa dung lượng và mở nhanh hơn nhiều. Mặc dù có sẵn trình ghi XLSX, nhưng các trình ghi định dạng khác cũng có sẵn để người dùng có thể tận dụng các đặc điểm độc đáo của từng định dạng Trọng tâm chính của Phiên bản cộng đồng là trao đổi dữ liệu chính xác, tập trung vào trích xuất dữ liệu từ bất kỳ biểu diễn dữ liệu tương thích nào và xuất dữ liệu ở nhiều định dạng khác nhau phù hợp với mọi giao diện của bên thứ ba Phân tích sổ làm việcĐể phân tích cú pháp, bước đầu tiên là đọc tệp. Điều này liên quan đến việc thu thập dữ liệu và đưa nó vào thư viện. Dưới đây là một vài tình huống phổ biến nodejs đọc một tệp (bấm để hiển thị)<script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>21 chỉ khả dụng trong môi trường máy chủ. Các trình duyệt không có API để đọc các tệp tùy ý được cung cấp một đường dẫn, vì vậy phải sử dụng một chiến lược khác if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */Photoshop ExtendScript đọc một tệp (bấm để hiển thị) <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>21 kết thúc logic <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>23 trong Photoshop và các mục tiêu ExtendScript khác. Đường dẫn đã chỉ định phải là đường dẫn tuyệt đối #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */ Bản demo <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>24 bao gồm một ví dụ phức tạp hơnTrình duyệt đọc phần tử BẢNG từ trang (bấm để hiển thị) Các hàm tiện ích <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>25 và <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>26 lấy một phần tử DOM TABLE và lặp qua các nút con if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */5 Nhiều bảng trên một trang web có thể được chuyển đổi thành các trang tính riêng lẻ <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>0 Ngoài ra, mã HTML có thể được trích xuất và phân tích cú pháp <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>1Tệp tải xuống trình duyệt (ajax) (bấm để hiển thị) Ghi chú. để biết ví dụ đầy đủ hơn hoạt động trong các trình duyệt cũ hơn, hãy xem bản trình diễn tại http. // oss. trang tính. com/js-xlsx/ajax. html. Bản trình diễn <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>27 bao gồm nhiều ví dụ hơn với <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>28 và <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>29 <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>2Trình duyệt kéo và thả (bấm để hiển thị) Kéo và thả sử dụng API HTML5 <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>30 <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>3Phần tử biểu mẫu tải lên tệp trình duyệt (bấm để hiển thị) Dữ liệu từ các phần tử đầu vào tệp có thể được xử lý bằng cách sử dụng cùng một API <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>30 như trong ví dụ kéo và thả <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>4 Bản trình diễn <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>32 hiển thị kịch bản dự phòng tương thích với IE Các trường hợp chuyên biệt hơn, bao gồm xử lý tệp ứng dụng dành cho thiết bị di động, được đề cập trong các bản trình diễn đi kèm Ví dụ phân tích cú pháp
Lưu ý rằng các phiên bản IE cũ hơn không hỗ trợ API tệp HTML5, vì vậy chế độ Base64 được sử dụng để thử nghiệm Nhận mã hóa Base64 trên OSX/Windows (bấm để hiển thị)Trên OSX, bạn có thể nhận mã hóa Base64 với <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>5 Trên Windows XP trở lên, bạn có thể lấy mã hóa Base64 bằng cách sử dụng <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>33 <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>6 (Ghi chú. Bạn phải mở tệp và xóa các dòng đầu trang và chân trang)
Đọc trực tuyếnTại sao không có API đọc trực tuyến?Các định dạng phổ biến và thú vị nhất (XLS, XLSX/M, XLSB, ODS) cuối cùng là các vùng chứa tệp ZIP hoặc CFB. Không định dạng nào đặt cấu trúc thư mục ở đầu tệp. Các tệp ZIP đặt các bản ghi Thư mục Trung tâm ở cuối tệp logic, trong khi các tệp CFB có thể đặt thông tin lưu trữ ở bất kỳ đâu trong tệp. Do đó, để xử lý đúng các định dạng này, chức năng phát trực tuyến sẽ phải đệm toàn bộ tệp trước khi bắt đầu. Điều đó trái với kỳ vọng của việc phát trực tuyến, vì vậy chúng tôi không cung cấp bất kỳ API đọc trực tuyến nào Khi xử lý Luồng có thể đọc được, cách tiếp cận đơn giản nhất là đệm luồng và xử lý toàn bộ nội dung ở cuối. Điều này có thể được thực hiện với một tệp tạm thời hoặc bằng cách nối rõ ràng luồng Các luồng kết nối rõ ràng (bấm để hiển thị)<script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>7 Các giải pháp mạnh mẽ hơn có sẵn bằng cách sử dụng các mô-đun như <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>34Ghi vào hệ thống tập tin đầu tiên (bấm vào để hiển thị) Ví dụ này sử dụng <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>35 để tạo tên tệp <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>8 Làm việc với Sổ làm việcĐịnh dạng đối tượng đầy đủ được mô tả sau trong README này Đọc một ô cụ thể (bấm để hiển thị)Ví dụ này trích xuất giá trị được lưu trữ trong ô A1 từ trang tính đầu tiên <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>9Thêm một trang tính mới vào sổ làm việc (bấm để hiển thị) Ví dụ này sử dụng <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>36 để tạo một trang tính và <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>37 để nối thêm trang tính vào sổ làm việc $ npm install xlsx0Tạo sổ làm việc mới từ đầu (bấm để hiển thị) Đối tượng sổ làm việc chứa một mảng tên <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>38 và tên trang tính ánh xạ đối tượng <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>39 với các đối tượng trang tính. Hàm tiện ích <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>40 tạo một đối tượng sổ làm việc mới $ npm install xlsx1 Sổ làm việc mới trống và không chứa trang tính nào. Các chức năng ghi sẽ lỗi nếu sổ làm việc trống Phân tích cú pháp và viết ví dụ
Phiên bản nút cài đặt công cụ dòng lệnh <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>41 có thể đọc các tệp bảng tính và xuất nội dung ở nhiều định dạng khác nhau. Nguồn có sẵn tại <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>42 trong thư mục bin Một số hàm trợ giúp trong <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>43 tạo ra các dạng xem khác nhau của trang tính
Viết sách bài tậpĐể viết, bước đầu tiên là tạo dữ liệu đầu ra. Các hàm trợ giúp <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>49 và <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>50 sẽ tạo dữ liệu ở các định dạng khác nhau phù hợp để phổ biến. Bước thứ hai là thực sự chia sẻ dữ liệu với điểm cuối. Giả sử <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>51 là một đối tượng sổ làm việcnodejs viết một tệp (bấm để hiển thị) <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>52 sử dụng <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>53 trong môi trường máy chủ $ npm install xlsx2Photoshop ExtendScript viết một tập tin (bấm để hiển thị) <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>50 kết thúc logic <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>23 trong Photoshop và các mục tiêu ExtendScript khác. Đường dẫn đã chỉ định phải là đường dẫn tuyệt đối $ npm install xlsx3 Bản demo <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>24 bao gồm một ví dụ phức tạp hơnTrình duyệt thêm phần tử BẢNG vào trang (bấm để hiển thị) Hàm tiện ích <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>57 tạo mã HTML có thể được thêm vào bất kỳ phần tử DOM nào $ npm install xlsx4Tệp tải lên trình duyệt (ajax) (bấm để hiển thị) Một ví dụ hoàn chỉnh sử dụng XHR được bao gồm trong bản trình diễn XHR, cùng với các ví dụ về thư viện tìm nạp và trình bao bọc. Ví dụ này giả định rằng máy chủ có thể xử lý các tệp được mã hóa Base64 (xem bản demo cho máy chủ nodejs cơ bản) $ npm install xlsx5Tệp lưu trình duyệt (bấm để hiển thị) <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>52 kết thúc một số kỹ thuật để kích hoạt lưu tệp
Không có cách tiêu chuẩn nào để xác định xem tệp thực đã được tải xuống chưa $ npm install xlsx6Tệp lưu trình duyệt (tương thích) (bấm để hiển thị) Các kỹ thuật <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>52 hoạt động với hầu hết các trình duyệt hiện đại cũng như IE cũ hơn. Đối với các trình duyệt cũ hơn nhiều, có các cách giải quyết được triển khai bởi các thư viện trình bao bọc <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>63 dụng cụ <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>64. Ghi chú. <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>52 sẽ tự động gọi cho <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>64 nếu có $ npm install xlsx7 <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>67 sử dụng nút Flash SWF để tạo tệp cục bộ, phù hợp với môi trường không có ActiveX $ npm install xlsx8 Bản trình diễn <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>32 hiển thị kịch bản dự phòng tương thích với IE Các bản demo đi kèm bao gồm các ứng dụng dành cho thiết bị di động và các triển khai đặc biệt khác Viết ví dụ
Viết trực tuyếnCác chức năng ghi trực tuyến có sẵn trong đối tượng <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>69. Chúng lấy các đối số giống như các hàm ghi bình thường nhưng trả về Luồng có thể đọc được. Chúng chỉ được hiển thị trong NodeJS
$ npm install xlsx9nodejs viết luồng JSON lên màn hình (bấm để hiển thị) $ bower install js-xlsx0 https. //github. ống com/sheetjs/sheetaki ghi luồng vào phản hồi của nodejs giao diện<script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>76 là biến được hiển thị trong trình duyệt và biến nút đã xuất <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>77 là phiên bản của thư viện (được thêm vào bởi tập lệnh xây dựng) <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>78 là phiên bản nhúng của thư viện định dạng chức năng phân tích cú pháp<script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>79 cố gắng phân tích cú pháp <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>80 <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>81 cố gắng đọc <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>82 và phân tích cú pháp Tùy chọn phân tích cú pháp được mô tả trong phần Tùy chọn phân tích cú pháp viết hàm<script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>83 cố gắng viết sổ làm việc <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>84 <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>85 cố gắng viết <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>84 thành <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>82. Trong môi trường dựa trên trình duyệt, nó sẽ cố gắng buộc tải xuống phía máy khách <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>88 cố gắng viết <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>84 thành <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>82. Nếu bỏ qua <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>91, người viết sẽ sử dụng đối số thứ ba làm hàm gọi lại <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>69 chứa một tập hợp các chức năng ghi trực tuyến Các tùy chọn viết được mô tả trong phần Tùy chọn viết tiện íchCác tiện ích có sẵn trong đối tượng <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>43 và được mô tả trong phần Chức năng tiện ích nhập khẩu
xuất khẩu
Thao tác ô và địa chỉ ô
Định dạng bảng tính chungjs-xlsx tuân theo Định dạng bảng tính chung (CSF) cấu trúc chungCác đối tượng địa chỉ ô được lưu trữ dưới dạng $ npm install xlsx09 trong đó $ npm install xlsx10 và $ npm install xlsx11 lần lượt là số cột và hàng được lập chỉ mục 0. Ví dụ: địa chỉ ô $ npm install xlsx12 được đại diện bởi đối tượng $ npm install xlsx13 Các đối tượng phạm vi ô được lưu trữ dưới dạng $ npm install xlsx14 trong đó $ npm install xlsx15 là ô đầu tiên và $ npm install xlsx16 là ô cuối cùng trong phạm vi. Các phạm vi được bao gồm. Ví dụ: phạm vi $ npm install xlsx17 được đại diện bởi đối tượng $ npm install xlsx18. Các hàm tiện ích thực hiện duyệt theo thứ tự hàng lớn của một phạm vi trang tính $ bower install js-xlsx1 đối tượng tế bàoCác đối tượng ô là các đối tượng JS đơn giản với các khóa và giá trị tuân theo quy ước Mô tả khóa$ npm install xlsx19giá trị thô (xem phần Loại dữ liệu để biết thêm thông tin) $ npm install xlsx20văn bản được định dạng (nếu có) $ npm install xlsx21loại. $ npm install xlsx22 Boolean, $ npm install xlsx23 Error, $ npm install xlsx24 Number, $ npm install xlsx25 Date, $ npm install xlsx26 Text, $ npm install xlsx27 Stub $ npm install xlsx28công thức ô được mã hóa dưới dạng chuỗi kiểu A1 (nếu có) $ npm install xlsx29phạm vi của mảng kèm theo nếu công thức là công thức mảng (nếu có) $ npm install xlsx30mã hóa văn bản đa dạng thức (nếu có) $ npm install xlsx31HTML Các tiện ích xuất tích hợp sẵn (chẳng hạn như trình xuất CSV) sẽ sử dụng văn bản $ npm install xlsx20 nếu có. Để thay đổi một giá trị, hãy nhớ xóa $ npm install xlsx39 (hoặc đặt thành $ npm install xlsx40) trước khi thử xuất. Các tiện ích sẽ tạo lại văn bản $ npm install xlsx20 từ định dạng số ( $ npm install xlsx42) và giá trị thô nếu có thể Công thức mảng thực tế được lưu trữ trong trường $ npm install xlsx28 của ô đầu tiên trong phạm vi mảng. Các ô khác trong phạm vi sẽ bỏ qua trường $ npm install xlsx28 Loại dữ liệuGiá trị thô được lưu trữ trong thuộc tính giá trị $ npm install xlsx19, được diễn giải dựa trên thuộc tính loại $ npm install xlsx21. Sự tách biệt này cho phép biểu diễn các số cũng như văn bản số. Có 6 loại ô hợp lệLoạiMô tả $ npm install xlsx22Boolean. giá trị được hiểu là JS $ npm install xlsx48 $ npm install xlsx23Error. giá trị là một mã số và tài sản $ npm install xlsx20 lưu trữ tên chung ** $ npm install xlsx24Number. giá trị là một JS $ npm install xlsx52 **______725Date. giá trị là một đối tượng hoặc chuỗi JS $ npm install xlsx54 được phân tích thành Ngày ** $ npm install xlsx26Text. giá trị được hiểu là JS $ npm install xlsx56 và được viết dưới dạng văn bản ** $ npm install xlsx27Stub. ô sơ khai trống bị các tiện ích xử lý dữ liệu bỏ qua **Giá trị lỗi và diễn giải (bấm để hiển thị)Giá trịLỗi Ý nghĩa $ npm install xlsx58 $ npm install xlsx59 $ npm install xlsx60 $ npm install xlsx61 $ npm install xlsx62 $ npm install xlsx63 $ npm install xlsx64 $ npm install xlsx65 $ npm install xlsx66 $ npm install xlsx67 $ npm install xlsx68 $ npm install xlsx69 $ npm install xlsx70 $ npm install xlsx71 $ npm install xlsx72 $ npm install xlsx73 Loại $ npm install xlsx24 là loại Số. Điều này bao gồm tất cả các dạng dữ liệu mà Excel lưu trữ dưới dạng số, chẳng hạn như ngày/thời gian và trường Boolean. Excel độc quyền sử dụng dữ liệu có thể vừa với số dấu phẩy động IEEE 754, giống như Số JS, đối với trường ________ 719 giữ số thô. Trường $ npm install xlsx20 giữ văn bản được định dạng. Ngày được lưu trữ dưới dạng số theo mặc định và được chuyển đổi bằng $ npm install xlsx77 Loại $ npm install xlsx25 là loại Ngày, chỉ được tạo khi tùy chọn $ npm install xlsx79 được thông qua. Vì JSON không có loại Ngày tự nhiên, nên các trình phân tích cú pháp thường được mong đợi sẽ lưu trữ các chuỗi Ngày theo tiêu chuẩn ISO 8601 giống như bạn sẽ nhận được từ $ npm install xlsx80. Mặt khác, người viết và người xuất sẽ có thể xử lý chuỗi ngày và đối tượng Ngày JS. Lưu ý rằng Excel bỏ qua các công cụ sửa đổi múi giờ và xử lý tất cả các ngày theo múi giờ địa phương. Thư viện không sửa lỗi này Loại $ npm install xlsx26 là loại Chuỗi. Các giá trị được lưu trữ rõ ràng dưới dạng văn bản. Excel sẽ hiểu các ô này là "số được lưu dưới dạng văn bản". Các tệp Excel được tạo sẽ tự động loại bỏ loại lỗi đó, nhưng các định dạng khác có thể gây ra lỗi Loại $ npm install xlsx27 đại diện cho các ô sơ khai trống. Chúng được tạo trong trường hợp các ô không có giá trị được gán nhưng chứa nhận xét hoặc siêu dữ liệu khác. Chúng bị bỏ qua bởi các chức năng tiện ích xử lý dữ liệu thư viện lõi. Theo mặc định, các ô này không được tạo; ngàyChi tiết mã ngày Excel (bấm để hiển thị)Theo mặc định, Excel lưu trữ ngày tháng dưới dạng số với mã định dạng chỉ định xử lý ngày tháng. Ví dụ: ngày $ npm install xlsx85 được lưu dưới dạng số $ npm install xlsx86 với định dạng số là $ npm install xlsx87. Mô-đun $ npm install xlsx88 hiểu các định dạng số và thực hiện chuyển đổi thích hợp XLSX cũng hỗ trợ loại ngày đặc biệt $ npm install xlsx25 trong đó dữ liệu là chuỗi ngày theo tiêu chuẩn ISO 8601. Trình định dạng chuyển đổi ngày trở lại thành một số Hành vi mặc định cho tất cả các trình phân tích cú pháp là tạo các ô số. Đặt $ npm install xlsx79 thành true sẽ buộc trình tạo lưu trữ ngàyMúi giờ và ngày (bấm để hiển thị) Excel không có khái niệm riêng về thời gian toàn cầu. Tất cả thời gian được chỉ định theo múi giờ địa phương. Các giới hạn của Excel ngăn việc chỉ định ngày tuyệt đối thực Theo Excel, thư viện này xử lý tất cả các ngày liên quan đến múi giờ địa phương kỷ nguyên. 1900 và 1904 (bấm vào để hiển thị)Excel hỗ trợ hai kỷ nguyên (ngày 1 tháng 1 năm 1900 và ngày 1 tháng 1 năm 1904), xem "1900 so với. Bài viết Hệ thống ngày tháng năm 1904". Kỷ nguyên của sổ làm việc có thể được xác định bằng cách kiểm tra thuộc tính $ npm install xlsx91 của sổ làm việc $ bower install js-xlsx2 Đối tượng trang tínhMỗi khóa không bắt đầu bằng $ npm install xlsx92 ánh xạ tới một ô (sử dụng ký hiệu $ npm install xlsx93) $ npm install xlsx94 trả về đối tượng ô cho địa chỉ đã chỉ định Các phím trang tính đặc biệt (có thể truy cập dưới dạng $ npm install xlsx95, mỗi phím bắt đầu bằng $ npm install xlsx92)
$ bower install js-xlsx03left margin (inches) $ bower install js-xlsx04 $ bower install js-xlsx05 $ bower install js-xlsx06 $ bower install js-xlsx07right margin (inches) $ bower install js-xlsx04 $ bower install js-xlsx05 $ bower install js-xlsx06 $ bower install js-xlsx11top margin (inches) $ bower install js-xlsx12 $ bower install js-xlsx05 $ bower install js-xlsx12 $ bower install js-xlsx15bottom margin (inches) $ bower install js-xlsx12 $ bower install js-xlsx05 $ bower install js-xlsx12 $ bower install js-xlsx19header margin (inches) $ bower install js-xlsx20 $ bower install js-xlsx21 $ bower install js-xlsx20 $ bower install js-xlsx23footer margin (inches) $ bower install js-xlsx20 $ bower install js-xlsx21 $ bower install js-xlsx20 $ bower install js-xlsx3 đối tượng trang tínhNgoài các phím trang tính cơ sở, trang tính cũng thêm
$ bower install js-xlsx34Bỏ chọn "Các hàng tóm tắt bên dưới chi tiết" $ bower install js-xlsx35 $ bower install js-xlsx03Bỏ chọn "Các hàng tóm tắt bên phải chi tiết" $ bower install js-xlsx35
$ bower install js-xlsx42Select locked cellsenabled $ bower install js-xlsx43Select unlocked cellsenabled $ bower install js-xlsx44Format cellsdisabled $ bower install js-xlsx45Format columnsdisabled $ bower install js-xlsx46Format rowsdisabled $ bower install js-xlsx47Insert columnsdisabled $ bower install js-xlsx48Insert rowsdisabled $ bower install js-xlsx49Insert hyperlinksdisabled $ bower install js-xlsx50Delete columnsdisabled $ bower install js-xlsx51Delete rowsdisabled $ bower install js-xlsx52Sortdisabled $ bower install js-xlsx53Filterdisabled $ bower install js-xlsx54Use PivotTable reportsdisabled $ bower install js-xlsx55Edit objectsenabled $ bower install js-xlsx56Edit scenariosenabled
$ bower install js-xlsx4 Đối tượng biểu đồBảng biểu đồ được thể hiện dưới dạng trang tiêu chuẩn. Chúng được phân biệt với thuộc tính $ bower install js-xlsx58 được đặt thành $ bower install js-xlsx59 Dữ liệu cơ bản và $ npm install xlsx98 đề cập đến dữ liệu được lưu trong bộ nhớ cache trong biểu đồ. Hàng đầu tiên của biểu đồ là tiêu đề cơ bản Đối tượng MacrosheetMacrosheet được biểu diễn dưới dạng các sheet tiêu chuẩn. Chúng được phân biệt với thuộc tính $ bower install js-xlsx58 được đặt thành $ bower install js-xlsx62 đối tượng bảng đối thoạiDialogsheets được biểu diễn dưới dạng các sheet tiêu chuẩn. Chúng được phân biệt với thuộc tính $ bower install js-xlsx58 được đặt thành $ bower install js-xlsx64 đối tượng sổ làm việc$ bower install js-xlsx65 là danh sách có thứ tự của các trang tính trong sổ làm việc $ bower install js-xlsx66 trả về một đối tượng đại diện cho trang tính $ bower install js-xlsx67 là một đối tượng lưu trữ các thuộc tính tiêu chuẩn. $ bower install js-xlsx68 lưu trữ các thuộc tính tùy chỉnh. Do các thuộc tính tiêu chuẩn của XLS khác với tiêu chuẩn của XLSX nên việc phân tích cú pháp XLS lưu trữ các thuộc tính cốt lõi ở cả hai nơi $ bower install js-xlsx69 lưu trữ các thuộc tính cấp sổ làm việc Thuộc tính tệp sổ làm việcCác định dạng tệp khác nhau sử dụng các tên nội bộ khác nhau cho thuộc tính tệp. Đối tượng sổ làm việc $ bower install js-xlsx70 bình thường hóa tênThuộc tính tệp (nhấp để hiển thị)Tên JSMô tả Excel $ bower install js-xlsx71Tab tóm tắt "Tiêu đề" $ bower install js-xlsx72Tab tóm tắt "Chủ đề" $ bower install js-xlsx73Tab tóm tắt "Tác giả" $ bower install js-xlsx74Tab tóm tắt "Người quản lý" $ bower install js-xlsx75Tab tóm tắt "Công ty" $ bower install js-xlsx76Tab tóm tắt "Danh mục" $ bower install js-xlsx77Tab tóm tắt "Từ khóa" $ bower install js-xlsx78Tab tóm tắt "Nhận xét" $ bower install js-xlsx79Thống kê Ví dụ: để đặt thuộc tính tiêu đề sổ làm việc $ bower install js-xlsx5 Các thuộc tính tùy chỉnh được thêm vào đối tượng sổ làm việc $ bower install js-xlsx81 $ bower install js-xlsx6 Người viết sẽ xử lý khóa $ bower install js-xlsx70 của đối tượng tùy chọn $ bower install js-xlsx7 Thuộc tính cấp sổ làm việc$ bower install js-xlsx69 lưu trữ các thuộc tính cấp sổ làm việc Tên được xác định$ bower install js-xlsx84 là một mảng các đối tượng tên được xác định có các khóaThuộc tính tên đã xác định (bấm để hiển thị)Mô tả chính $ bower install js-xlsx85Phạm vi tên. Sheet Index (0 = first sheet) or $ bower install js-xlsx86 (Workbook) $ bower install js-xlsx87Case-sensitive name. Các quy tắc tiêu chuẩn được áp dụng ** $ bower install js-xlsx88A1-style Reference ( $ bower install js-xlsx89) $ bower install js-xlsx90Comment (chỉ áp dụng cho XLS/XLSX/XLSB) Excel allows two sheet-scoped defined names to share the same name. Tuy nhiên, tên trong phạm vi trang tính không thể xung đột với tên trong phạm vi sổ làm việc. Người viết sổ làm việc có thể không thực thi ràng buộc này Chế độ xem sổ làm việc$ bower install js-xlsx91 is an array of workbook view objects which have the keysKeyDescription $ bower install js-xlsx92Nếu đúng, hiển thị từ phải sang trái Thuộc tính sổ làm việc khác$ bower install js-xlsx93 giữ các thuộc tính sổ làm việc khácKeyDescription $ bower install js-xlsx94VBA Project Workbook Code Name $ bower install js-xlsx95epoch. 0/false cho hệ thống 1900, 1/true cho 1904 $ bower install js-xlsx96Cảnh báo hoặc tước thông tin nhận dạng cá nhân khi lưu Tính năng tài liệuNgay cả đối với các tính năng cơ bản như lưu trữ ngày tháng, các định dạng Excel chính thức lưu trữ cùng một nội dung theo những cách khác nhau. Trình phân tích cú pháp dự kiến sẽ chuyển đổi từ biểu diễn định dạng tệp cơ bản sang Định dạng bảng tính chung. Người viết dự kiến sẽ chuyển đổi từ CSF trở lại định dạng tệp cơ bản công thứcChuỗi công thức kiểu A1 được lưu trữ trong trường $ npm install xlsx28. Mặc dù các định dạng tệp khác nhau lưu trữ các công thức theo những cách khác nhau, các định dạng được dịch. Mặc dù một số định dạng lưu trữ các công thức có dấu bằng ở đầu, các công thức CSF không bắt đầu bằng $ bower install js-xlsx98Representation of A1=1, A2=2, A3=A1+A2 (click to show) $ bower install js-xlsx8 Shared formulae are decompressed and each cell has the formula corresponding to its cell. Writers generally do not attempt to generate shared formulae Cells with formula entries but no value will be serialized in a way that Excel and other spreadsheet tools will recognize. This library will not automatically compute formula results. For example, to compute $ bower install js-xlsx99 in a worksheetFormula without known value (click to show) $ bower install js-xlsx9 Array Formulae Array formulae are stored in the top-left cell of the array block. All cells of an array formula have a $ npm install xlsx29 field corresponding to the range. A single-cell formula can be distinguished from a plain formula by the presence of $ npm install xlsx29 fieldArray Formula examples (click to show) For example, setting the cell #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */802 to the array formula #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */803 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */80 For a multi-cell array formula, every cell has the same array range but only the first cell specifies the formula. Consider #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */804 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */81 Utilities and writers are expected to check for the presence of a $ npm install xlsx29 field and ignore any possible formula element $ npm install xlsx28 in cells other than the starting cell. They are not expected to perform validation of the formulaeFormula Output Utility Function (click to show) The $ npm install xlsx03 method generates one line per formula or array formula. Array formulae are rendered in the form #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */808 while plain cells are rendered in the form #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */809. Note that string literals are prefixed with an apostrophe #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */810, consistent with Excel's formula bar displayFormulae File Format Details (click to show)Storage RepresentationFormatsReadWriteA1-style stringsXLSX⭕⭕RC-style stringsXLML and plain text⭕⭕BIFF Parsed formulaeXLSB and all XLS formats⭕OpenFormula formulaeODS/FODS/UOS⭕⭕ Since Excel prohibits named cells from colliding with names of A1 or RC style cell references, a (not-so-simple) regex conversion is possible. BIFF Parsed formulae have to be explicitly unwound. OpenFormula formulae can be converted with regular expressions Thuộc tính cộtThe #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */811 array in each worksheet, if present, is a collection of #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */812 objects which have the following properties #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */82Why are there three width types? (click to show) There are three different width types corresponding to the three different ways spreadsheets store column widths SYLK and other plain text formats use raw character count. Contemporaneous tools like Visicalc and Multiplan were character based. Since the characters had the same width, it sufficed to store a count. This tradition was continued into the BIFF formats SpreadsheetML (2003) tried to align with HTML by standardizing on screen pixel count throughout the file. Column widths, row heights, and other measures use pixels. When the pixel and character counts do not align, Excel rounds values XLSX internally stores column widths in a nebulous "Max Digit Width" form. The Max Digit Width is the width of the largest digit when rendered (generally the "0" character is the widest). Chiều rộng bên trong phải là bội số nguyên của chiều rộng chia cho 256. ECMA-376 describes a formula for converting between pixels and the internal width. This represents a hybrid approach Read functions attempt to populate all three properties. Write functions will try to cycle specified values to the desired type. In order to avoid potential conflicts, manipulation should delete the other properties first. For example, when changing the pixel width, delete the $ bower install js-xlsx29 and #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */814 propertiesImplementation details (click to show) Given the constraints, it is possible to determine the MDW without actually inspecting the font. The parsers guess the pixel width by converting from width to pixels and back, repeating for all possible MDW and selecting the MDW that minimizes the error. XLML actually stores the pixel width, so the guess works in the opposite direction Even though all of the information is made available, writers are expected to follow the priority order
Thuộc tính hàngThe #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */818 array in each worksheet, if present, is a collection of #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */819 objects which have the following properties #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */83 Note. Excel UI displays the base outline level as #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */820 and the max level as #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */821. The #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */822 field stores the base outline as #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */823 and the max level as #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */824Implementation details (click to show) Excel internally stores row heights in points. The default resolution is 72 DPI or 96 PPI, so the pixel and point size should agree. For different resolutions they may not agree, so the library separates the concepts Even though all of the information is made available, writers are expected to follow the priority order
định dạng sốThe $ npm install xlsx39 formatted text for each cell is produced from #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */828 and $ npm install xlsx42 format. If the format is not specified, the Excel #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */830 format is used. The format can either be specified as a string or as an index into the format table. Parsers are expected to populate #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */831 with the number format table. Writers are expected to serialize the table Custom tools should ensure that the local table has each used format string somewhere in the table. Excel convention mandates that the custom formats start at index 164. The following example creates a custom format from scratch New worksheet with custom format (click to show)#include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */84 The rules are slightly different from how Excel displays custom number formats. In particular, literal characters must be wrapped in double quotes or preceded by a backslash. For more info, see the Excel documentation article #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */832 or ECMA-376 18. 8. 31 (Number Formats)Default Number Formats (click to show) The default formats are listed in ECMA-376 18. 8. 30 IDFormat0#include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */8301 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */8232 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */8353 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */8364 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */8379 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */83810 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */83911 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */84012 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */84113 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */84214 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */843 (see below)15 $ npm install xlsx8716 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */84517 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */84618 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */84719 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */84820 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */84921 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */85022 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */85137 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */85238 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */85339 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */85440 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */85545 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */85646 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */85747 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */85848 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */85949 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */860 Format 14 ( #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */843) is localized by Excel. even though the file specifies that number format, it will be drawn differently based on system settings. It makes sense when the producer and consumer of files are in the same locale, but that is not always the case over the Internet. To get around this ambiguity, parse functions accept the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */862 option to override the interpretation of that specific format string siêu liên kếtHyperlinks are stored in the $ npm install xlsx34 key of cell objects. The #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */864 field of the hyperlink object is the target of the link, including the URI fragment. Tooltips are stored in the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */865 field and are displayed when you move your mouse over the text For example, the following snippet creates a link from cell #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */866 to http. //sheetjs. com with the tip #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */867 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */85 Note that Excel does not automatically style hyperlinks -- they will generally be displayed as normal text Links where the target is a cell or range or defined name in the same workbook ("Internal Links") are marked with a leading hash character #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */86 Nhận xét di độngCell comments are objects stored in the $ npm install xlsx32 array of cell objects. The actual contents of the comment are split into blocks based on the comment author. The #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */869 field of each comment object is the author of the comment and the $ npm install xlsx21 field is the plain text representation For example, the following snippet appends a cell comment into cell #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */871 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */87 Note. XLSB enforces a 54 character limit on the Author name. Names longer than 54 characters may cause issues with other formats To mark a comment as normally hidden, set the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */872 property #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */88 Khả năng hiển thị trang tínhExcel enables hiding sheets in the lower tab bar. The sheet data is stored in the file but the UI does not readily make it available. Standard hidden sheets are revealed in the "Unhide" menu. Excel also has "very hidden" sheets which cannot be revealed in the menu. It is only accessible in the VB Editor The visibility setting is stored in the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */873 property of sheet props arrayMore details (click to show)ValueDefinition0Visible1Hidden2Very Hidden With https. //rawgit. com/SheetJS/test_files/master/sheet_visibility. xlsx #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */89 Non-Excel formats do not support the Very Hidden state. The best way to test if a sheet is visible is to check if the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */873 property is logical truth #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */20 VBA và MacroVBA Macros are stored in a special data blob that is exposed in the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */875 property of the workbook object when the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */876 option is $ npm install xlsx84. They are supported in #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */878, #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */879, and #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */880 formats. The supported format writers automatically insert the data blobs if it is present in the workbook and associate with the worksheet namesCustom Code Names (click to show) The workbook code name is stored in #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */881. By default, Excel will write #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */882 or a translated phrase like #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */883. Worksheet and Chartsheet code names are in the worksheet properties object at #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */884. Macrosheets and Dialogsheets are ignored The readers and writers preserve the code names, but they have to be manually set when adding a VBA blob to a different workbook Macrosheets (bấm để hiển thị)Older versions of Excel also supported a non-VBA "macrosheet" sheet type that stored automation commands. These are exposed in objects with the $ bower install js-xlsx58 property set to $ bower install js-xlsx62Detecting macros in workbooks (click to show) The #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */875 field will only be set if macros are present, so testing is simple #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */21 Tùy chọn phân tích cú phápThe exported #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */888 and <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>21 functions accept an options argumentOption NameDefaultDescription #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */890Input data encoding (see Input Type below) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */891falseIf true, plain text parsing will not parse values ** #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */892If specified, use code page when appropriate ** #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */893trueSave formulae to the . f field #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */894trueParse rich text and save HTML to the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */895 field #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */896falseSave number format string to the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */897 field #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */898falseSave style/theme info to the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */899 field #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */200trueGenerated formatted text to the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */201 field $ npm install xlsx79falseStore dates as type $ npm install xlsx25 (default is $ npm install xlsx24) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */862If specified, use the string for date code 14 ** $ npm install xlsx83falseCreate cell objects of type $ npm install xlsx27 for stub cells $ bower install js-xlsx000If >0, read the first $ bower install js-xlsx00 rows ** #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */210falseIf true, parse calculation chains #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */211falseIf true, add raw files to book object ** #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */212falseIf true, only parse enough to get book metadata ** #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */213falseIf true, only parse enough to get the sheet names #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */876falseIf true, copy VBA blob to #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */875 field ** $ bower install js-xlsx39""If defined and file is encrypted, use password ** #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */217falseIf true, throw errors on unexpected file features ** #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */218If specified, only parse specified sheets ** #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */219falseIf true, allow parsing of PRN files ** #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */220falseIf true, preserve #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */221 prefixes in formulae **
Kiểu đầu vàoStrings can be interpreted in multiple ways. The #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */890 parameter for #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */888 tells the library how to parse the data argument #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */890expected input #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */250string. Base64 encoding of the file #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */251string. binary string (byte $ npm install xlsx24 is #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */253) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */254string. JS string (characters interpreted as UTF8) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */255nodejs Buffer #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */256array. array of 8-bit unsigned int (byte $ npm install xlsx24 is #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */258) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */259string. path of file that will be read (nodejs only) đoán loại tập tinImplementation Details (click to show)Excel and other spreadsheet tools read the first few bytes and apply other heuristics to determine a file type. This enables file type punning. renaming files with the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */260 extension will tell your computer to use Excel to open the file but Excel will know how to handle it. This library applies similar logicByte 0Raw File TypeSpreadsheet Types #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */261CFB ContainerBIFF 5/8 or password-protected XLSX/XLSB or WQ3/QPW #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */262BIFF StreamBIFF 2/3/4/5 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */263XML/HTMLSpreadsheetML / Flat ODS / UOS1 / HTML / plain text #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */264ZIP ArchiveXLSB or XLSX/M or ODS or UOS2 or plain text #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */265Plain TextSYLK or plain text #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */266Plain TextDIF or plain text #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */267UTF8 EncodedSpreadsheetML / Flat ODS / UOS1 / HTML / plain text #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */268UTF16 EncodedSpreadsheetML / Flat ODS / UOS1 / HTML / plain text $ npm install xlsx58Record StreamLotus WK* or Quattro Pro or plain text #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */270Plain textRTF or plain text #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */271Plain textSpreadsheetML / Flat ODS / UOS1 / HTML / plain text #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */272Plain textSpreadsheetML / Flat ODS / UOS1 / HTML / plain text #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */273Plain textSpreadsheetML / Flat ODS / UOS1 / HTML / plain text DBF files are detected based on the first byte as well as the third and fourth bytes (corresponding to month and day of the file date) Plain text format guessing follows the priority order FormatTestXML#include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */274 xuất hiện trong 1024 ký tự đầu tiênHTMLbắt đầu bằng #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */275 và các thẻ HTML xuất hiện trong 1024 ký tự đầu tiên *XMLbắt đầu bằng #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */275RTFbắt đầu bằng #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */277DSVbắt đầu bằng #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */278, dấu phân cách là ký tự được chỉ địnhDSVnhiều ký tự #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */279 không được trích dẫn hơn so với #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */280 hoặc
Excel is extremely aggressive in reading files. Adding an XLS extension to any display text file (where the only characters are ANSI display chars) tricks Excel into thinking that the file is potentially a CSV or TSV file, even if it is only one column. This library attempts to replicate that behavior The best approach is to validate the desired worksheet and ensure it has the expected number of rows or columns. Extracting the range is extremely simple #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */22 tùy chọn viếtThe exported <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>49 and <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>50 functions accept an options argumentOption NameDefaultDescription #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */890Output data encoding (see Output Type below) $ npm install xlsx79 $ bower install js-xlsx35Store dates as type $ npm install xlsx25 (default is $ npm install xlsx24) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */500 $ bower install js-xlsx35Generate Shared String Table ** #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */502 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */503Type of Workbook (see below for supported formats) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */504 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */505Name of Worksheet for single-sheet formats ** #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */506 $ bower install js-xlsx35Use ZIP compression for ZIP-based formats ** $ bower install js-xlsx70Override workbook properties when writing ** #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */509Override theme XML when writing XLSX/XLSB/XLSM ** #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */510 $ npm install xlsx84Suppress "number as text" errors **
Định dạng đầu ra được hỗ trợFor broad compatibility with third-party tools, this library supports many output formats. The specific file type is controlled with #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */502 option #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */502file extcontainersheetsDescription <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>41 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */524ZIPmultiExcel 2007+ XML Format #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */525 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */526ZIPmultiExcel 2007+ Macro XML Format #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */527 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */528ZIPmultiExcel 2007+ Binary Format #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */529 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */260CFBmultiExcel 97-2004 Workbook Format #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */531 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */260CFBmultiExcel 5. 0/95 Workbook Format #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */533 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */260nonesingleExcel 2. 0 Worksheet Format #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */535 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */260nonemultiExcel 2003-2004 (SpreadsheetML) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */537 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */538ZIPmultiOpenDocument Spreadsheet #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */539 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */540nonemultiFlat OpenDocument Spreadsheet #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */541 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */542nonesingleComma Separated Values #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */543 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */544nonesingleUTF-16 Unicode Text (TXT) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */545 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */546nonesingleSymbolic Link (SYLK) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */286 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */548nonesingleHTML Document #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */549 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */550nonesingleData Interchange Format (DIF) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */551 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */552nonesingledBASE II + VFP Extensions (DBF) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */553 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */554nonesingleRich Text Format (RTF) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */555 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */556nonesingleLotus Formatted Text #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */557 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */558nonesingleEthercalc Record Format (ETH)
Loại đầu raThe #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */890 argument for <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>49 mirrors the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */890 argument for #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */888 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */890output #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */250string. Base64 encoding of the file #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */251string. binary string (byte $ npm install xlsx24 is #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */253) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */254string. JS string (characters interpreted as UTF8) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */255nodejs Buffer #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */256ArrayBuffer, fallback array of 8-bit unsigned int #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */259string. path of file that will be created (nodejs only) Các chức năng tiện íchThe #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */576 functions accept a worksheet and an optional options object The #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */577 functions accept a data object and an optional options object The examples are based on the following worksheet #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */23 Mảng đầu vào mảng<script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>36 takes an array of arrays of JS values and returns a worksheet resembling the input data. Numbers, Booleans and Strings are stored as the corresponding styles. Dates are stored as date or numbers. Array holes and explicit $ npm install xlsx40 values are skipped. $ bower install js-xlsx86 values may be stubbed. All other values are stored as strings. The function takes an options argumentOption NameDefaultDescription #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */862FMT 14Use specified date format in string output $ npm install xlsx79falseStore dates as type $ npm install xlsx25 (default is $ npm install xlsx24) $ npm install xlsx83falseCreate cell objects of type $ npm install xlsx27 for $ bower install js-xlsx86 valuesExamples (click to show) To generate the example sheet #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */24 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */588 takes an array of arrays of JS values and updates an existing worksheet object. It follows the same process as <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>94 and accepts an options argumentOption NameDefaultDescription #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */862FMT 14Use specified date format in string output $ npm install xlsx79falseStore dates as type $ npm install xlsx25 (default is $ npm install xlsx24) $ npm install xlsx83falseCreate cell objects of type $ npm install xlsx27 for $ bower install js-xlsx86 values #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */597Use specified cell as starting point (see below) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */597 is expected to be one of #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */597Description(cell object)Use specified cell (cell object)(string)Use specified cell (A1-style cell)(number >= 0)Start from the first column at specified row (0-indexed)-1Append to bottom of worksheet starting on first column(default)Start from cell A1Examples (click to show) Consider the worksheet #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */25 This worksheet can be built up in the order if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */00 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */26 Mảng đối tượng đầu vàoif(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */01 takes an array of objects and returns a worksheet with automatically-generated "headers" based on the keys of the objects. The default column order is determined by the first appearance of the field using if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */02, but can be overridden using the options argumentOption NameDefaultDescription $ bower install js-xlsx19Use specified column order (default if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */02) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */862FMT 14Use specified date format in string output $ npm install xlsx79falseStore dates as type $ npm install xlsx25 (default is $ npm install xlsx24) if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */09falseIf true, do not include header row in outputExamples (click to show) The original sheet cannot be reproduced using plain objects since JS object keys must be unique. After replacing the second $ npm install xlsx23 and $ npm install xlsx15 with if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */12 and if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */13 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */27 Alternatively, the header row can be skipped #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */28 if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */14 takes an array of objects and updates an existing worksheet object. It follows the same process as <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>95 and accepts an options argumentOption NameDefaultDescription $ bower install js-xlsx19Use specified column order (default if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */02) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */862FMT 14Use specified date format in string output $ npm install xlsx79falseStore dates as type $ npm install xlsx25 (default is $ npm install xlsx24) if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */09falseIf true, do not include header row in output #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */597Use specified cell as starting point (see below) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */597 is expected to be one of #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */597Description(cell object)Use specified cell (cell object)(string)Use specified cell (A1-style cell)(number >= 0)Start from the first column at specified row (0-indexed)-1Append to bottom of worksheet starting on first column(default)Start from cell A1Examples (click to show) Consider the worksheet #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */25 This worksheet can be built up in the order if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */00 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */50 Đầu vào bảng HTMLif(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */27 takes a table DOM element and returns a worksheet resembling the input table. Numbers are parsed. All other data will be stored as strings if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */28 produces a minimal workbook based on the worksheet Cả hai chức năng chấp nhận đối số tùy chọn Option NameDefaultDescription#include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */891If true, every cell will hold raw strings #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */862FMT 14Use specified date format in string output $ npm install xlsx79falseStore dates as type $ npm install xlsx25 (default is $ npm install xlsx24) $ bower install js-xlsx000If >0, read the first $ bower install js-xlsx00 rows of the table if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */36falseIf true, hidden rows and cells will not be parsedExamples (click to show) To generate the example sheet, start with the HTML table #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */51 To process the table #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */52 Note. if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */37 can handle HTML represented as strings if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */38 takes a table DOM element and updates an existing worksheet object. It follows the same process as <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>26 and accepts an options argumentOption NameDefaultDescription #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */891If true, every cell will hold raw strings #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */862FMT 14Use specified date format in string output $ npm install xlsx79falseStore dates as type $ npm install xlsx25 (default is $ npm install xlsx24) $ bower install js-xlsx000If >0, read the first $ bower install js-xlsx00 rows of the table if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */36falseIf true, hidden rows and cells will not be parsed #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */597 is expected to be one of #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */597Description(cell object)Use specified cell (cell object)(string)Use specified cell (A1-style cell)(number >= 0)Start from the first column at specified row (0-indexed)-1Append to bottom of worksheet starting on first column(default)Start from cell A1Examples (click to show) A small helper function can create gap rows between tables #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */53 Đầu ra công thức<script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>48 generates an array of commands that represent how a person would enter data into an application. Each entry is of the form if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */51. String literals are prefixed with a #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */810 in accordance with ExcelExamples (click to show) For the example sheet #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */54 Đầu ra được phân tách bằng dấu phân cáchAs an alternative to the <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>50 CSV type, <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>44 also produces CSV output. The function takes an options argumentOption NameDefaultDescription if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */55 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */281"Field Separator" delimiter between fields if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */57 if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */58"Record Separator" delimiter between rows #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */862FMT 14Use specified date format in string output if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */60falseRemove trailing field separators in each record ** if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */61trueInclude blank lines in the CSV output if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */62falseSkips hidden rows/columns in the CSV output if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */63falseForce quotes around fields
For the example sheet #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */55 Văn bản Unicode UTF-16The #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */543 output type uses the tab character as the field separator. If the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */892 library is available (included in full distribution but not core), the output will be encoded in if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */71 and the BOM will be prepended <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>45 lấy các đối số giống như $ npm install xlsx00 Đầu ra HTMLAs an alternative to the <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>50 HTML type, <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>46 also produces HTML output. The function takes an options argumentOption NameDefaultDescription if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */76Specify the if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */76 attribute for the if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */78 element if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */79falseIf true, set if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */80 for every TD $ bower install js-xlsx19Override header (default if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */82) $ bower install js-xlsx23Override footer (default if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */84)Examples (click to show) For the example sheet #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */56 JSON<script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>47 generates different types of JS objects. The function takes an options argumentOption NameDefaultDescription #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */891 $ npm install xlsx84Use raw values (true) or formatted strings (false) if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */88from WSOverride Range (see table below) $ bower install js-xlsx19Control output format (see table below) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */862FMT 14Use specified date format in string output if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */91Use specified value in place of null or undefined if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */61**Include blank lines in the output **
if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */88 is expected to be one of if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */88Description(number)Use worksheet range but set starting row to the value(string)Use specified range (A1-style bounded range string)(default)Use worksheet range ( #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */18) $ bower install js-xlsx19 is expected to be one of $ bower install js-xlsx19Description #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */820Generate an array of arrays ("2D Array") #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */22Row object keys are literal column labelsarray of stringsUse specified strings as keys in row objects(default)Read and disambiguate first row as keys If header is not #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */820, the row object will contain the non-enumerable property #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */24 that represents the row of the sheet corresponding to the entryExamples (click to show) For the example sheet #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */57 Example showing the effect of #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */891 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */58 Định dạng tệpDespite the library name <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>41, it supports numerous spreadsheet file formatsFormatReadWriteExcel Worksheet/Workbook Formats. -----. -----. Excel 2007+ XML Formats (XLSX/XLSM)⭕⭕Excel 2007+ Binary Format (XLSB BIFF12)⭕⭕Excel 2003-2004 XML Format (XML "SpreadsheetML")⭕⭕Excel 97-2004 (XLS BIFF8)⭕⭕Excel 5. 0/95 (XLS BIFF5)⭕⭕Excel 4. 0 (XLS/XLW BIFF4)⭕Excel 3. 0 (XLS BIFF3)⭕Excel 2. 0/2. 1 (XLS BIFF2)⭕⭕Excel Supported Text Formats. -----. -----. Giá trị được phân tách bằng dấu phân tách (CSV/TXT)⭕⭕Định dạng trao đổi dữ liệu (DIF)⭕⭕Liên kết tượng trưng (SYLK/SLK)⭕⭕Văn bản định dạng hoa sen (PRN)⭕⭕Văn bản Unicode UTF-16 (TXT)⭕⭕Sổ bài/trang tính khác . -----. -----. OpenDocument Spreadsheet (ODS)⭕⭕Flat XML ODF Spreadsheet (FODS)⭕⭕Uniform Office Format Spreadsheet (标文通 UOS1/UOS2)⭕dBASE II/III/IV / Visual FoxPro (DBF)⭕⭕Lotus 1-2-3 (WKS/WK1/WK2/WK3/WK4/123)⭕Quattro Pro Spreadsheet (WQ1/WQ2/WB1/WB2/WB3/QPW)⭕Other Common Spreadsheet Output Formats. -----. -----. HTML Tables⭕⭕Rich Text Format tables (RTF)⭕Ethercalc Record Format (ETH)⭕⭕ Features not supported by a given file format will not be written. Formats with range limits will be silently truncated FormatLast CellMax ColsMax RowsExcel 2007+ XML Formats (XLSX/XLSM)XFD1048576163841048576Excel 2007+ Binary Format (XLSB BIFF12)XFD1048576163841048576Excel 97-2004 (XLS BIFF8)IV6553625665536Excel 5. 0/95 (XLS BIFF5)IV1638425616384Excel 2. 0/2. 1 (XLS BIFF2)IV1638425616384Excel 2003 SpreadsheetML range limits are governed by the version of Excel and are not enforced by the writer Excel 2007+ XML (XLSX/XLSM)(click to show)Các tệp XLSX và XLSM là các vùng chứa ZIP chứa một loạt tệp XML theo Quy ước Đóng gói Mở (OPC). The XLSM format, almost identical to XLSX, is used for files containing macros The format is standardized in ECMA-376 and later in ISO/IEC 29500. Excel không tuân theo đặc điểm kỹ thuật và có các tài liệu bổ sung thảo luận về cách Excel khác với đặc điểm kỹ thuật Excel 2. 0-95 (BIFF2/BIFF3/BIFF4/BIFF5)(click to show)BIFF 2/3 XLS là các luồng bản ghi nhị phân trên một trang tính. Excel 4 introduced the concept of a workbook ( #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */27 files) but also had single-sheet #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */28 format. The structure is largely similar to the Lotus 1-2-3 file formats. BIFF5/8/12 extended the format in various ways but largely stuck to the same record format There is no official specification for any of these formats. Excel 95 can write files in these formats, so record lengths and fields were determined by writing in all of the supported formats and comparing files. Excel 2016 can generate BIFF5 files, enabling a full suite of file tests starting from XLSX or BIFF2 Excel 97-2004 nhị phân (BIFF8)(click to show)BIFF8 exclusively uses the Compound File Binary container format, splitting some content into streams within the file. At its core, it still uses an extended version of the binary record format from older versions of BIFF The #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */29 specification covers the basics of the file format, and other specifications expand on serialization of features like properties Excel 2003-2004 (ML bảng tính)(click to show)Predating XLSX, SpreadsheetML files are simple XML files. There is no official and comprehensive specification, although MS has released documentation on the format. Since Excel 2016 can generate SpreadsheetML files, mapping features is pretty straightforward Excel 2007+ Nhị phân (XLSB, BIFF12)(click to show)Introduced in parallel with XLSX, the XLSB format combines the BIFF architecture with the content separation and ZIP container of XLSX. For the most part nodes in an XLSX sub-file can be mapped to XLSB records in a corresponding sub-file The #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */30 specification covers the basics of the file format, and other specifications expand on serialization of features like properties Giá trị được phân tách bằng dấu phân cách (CSV/TXT)(click to show)Excel CSV deviates from RFC4180 in a number of important ways. The generated CSV files should generally work in Excel although they may not work in RFC4180 compatible readers. The parser should generally understand Excel CSV. The writer proactively generates cells for formulae if values are unavailable Excel TXT uses tab as the delimiter and code page 1200 Notes
Các định dạng sổ làm việc khác(click to show)Support for other formats is generally far XLS/XLSB/XLSX support, due in large part to a lack of publicly available documentation. Test files were produced in the respective apps and compared to their XLS exports to determine structure. The main focus is data extraction Hoa sen 1-2-3 (WKS/WK1/WK2/WK3/WK4/123)(click to show)The Lotus formats consist of binary records similar to the BIFF structure. Lotus did release a specification decades ago covering the original WK1 format. Other features were deduced by producing files and comparing to Excel support Quattro Pro (WQ1/WQ2/WB1/WB2/WB3/QPW)(click to show)The Quattro Pro formats use binary records in the same way as BIFF and Lotus. Some of the newer formats (namely WB3 and QPW) use a CFB enclosure just like BIFF8 XLS Bảng tính OpenDocument (ODS/FODS)(click to show)ODS is an XML-in-ZIP format akin to XLSX while FODS is an XML format akin to SpreadsheetML. Both are detailed in the OASIS standard, but tools like LO/OO add undocumented extensions. The parsers and writers do not implement the full standard, instead focusing on parts necessary to extract and store raw data Bảng tính văn phòng thống nhất (UOS1/2)(click to show)UOS is a very similar format, and it comes in 2 varieties corresponding to ODS and FODS respectively. For the most part, the difference between the formats is in the names of tags and attributes Các định dạng trang tính đơn khácMany older formats supported only one worksheet dBASE và Visual FoxPro (DBF)(click to show)DBF is really a typed table format. each column can only hold one data type and each record omits type information. The parser generates a header row and inserts records starting at the second row of the worksheet. The writer makes files compatible with Visual FoxPro extensions Multi-file extensions like external memos and tables are currently unsupported, limited by the general ability to read arbitrary files in the web browser. The reader understands DBF Level 7 extensions like DATETIME Liên kết tượng trưng (SYLK)(click to show)There is no real documentation. All knowledge was gathered by saving files in various versions of Excel to deduce the meaning of fields. Notes
Văn bản định dạng hoa sen (PRN)(click to show)There is no real documentation, and in fact Excel treats PRN as an output-only file format. Tuy nhiên, chúng tôi có thể đoán độ rộng cột và thiết kế ngược lại bố cục ban đầu. Excel's 240 character width limitation is not enforced Định dạng trao đổi dữ liệu (DIF)(click to show)There is no unified definition. Visicalc DIF differs from Lotus DIF, and both differ from Excel DIF. Where ambiguous, the parser/writer follows the expected behavior from Excel. In particular, Excel extends DIF in incompatible ways
HTML(click to show)Excel HTML worksheets include special metadata encoded in styles. For example, #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */34 is a localized string containing the number format. Despite the metadata the output is valid HTML, although it does accept bare #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */35 symbols The writer adds type metadata to the TD elements via the $ npm install xlsx21 tag. The parser looks for those tags and overrides the default interpretation. For example, text like #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */37 will be parsed as numbers but #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */38 will be parsed as text Định dạng văn bản có định dạng (RTF)(click to show)Excel RTF worksheets are stored in clipboard when copying cells or ranges from a worksheet. The supported codes are a subset of the Word RTF support Định dạng Bản ghi Ethercalc (ETH)(click to show)Ethercalc is an open source web spreadsheet powered by a record format reminiscent of SYLK wrapped in a MIME multi-part message thử nghiệmNút(click to show)#include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */39 will run the node-based tests. By default it runs tests on files in every supported format. To test a specific file type, set #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */40 to the format you want to test. Feature-specific tests are available with #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */41 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */59 To enable all errors, set the environment variable #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */42 if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */0 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */43 and #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */44 checks are available if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */1 trình duyệt(click to show)The core in-browser tests are available at #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */45 within this repo. Start a local server and navigate to that directory to run the tests. #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */46 will start a server on port 8000 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */47 will generate the browser fixtures. To add more files, edit the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */48 file and add the paths To run the full in-browser tests, clone the repo for #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */49 and replace the <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>17 file (then open a browser window and go to #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */51) if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */2 Môi trường thử nghiệm(click to show)
Các thử nghiệm sử dụng khung thử nghiệm mocha. Travis-CI and Sauce Labs links
Bộ thử nghiệm Travis-CI cũng bao gồm các thử nghiệm cho các múi giờ khác nhau. Để thay đổi múi giờ cục bộ, hãy đặt biến môi trường TZ if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */3 tập tin kiểm traCác tệp thử nghiệm được đặt trong một repo khác Chạy #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */60 sẽ làm mới mô-đun con #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */61 và lấy các tệp. Lưu ý rằng điều này yêu cầu #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */62, #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */63, #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */64 và các lệnh khác có thể không khả dụng. Nếu #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */60 không thành công, vui lòng tải xuống phiên bản mới nhất của ảnh chụp tệp thử nghiệm từ kho lưu trữẢnh chụp mới nhất (bấm để hiển thị) Ảnh chụp tệp thử nghiệm mới nhất. http. //github. com/SheetJS/test_files/releases/download/20170409/test_files. zip (download and unzip to the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */61 subdirectory) Đóng gópDue to the precarious nature of the Open Specifications Promise, it is very important to ensure code is cleanroom. Contribution Notes File organization (click to show)At a high level, the final script is a concatenation of the individual files in the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */67 folder. Running #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */68 should reproduce the final output on all platforms. The README is similarly split into bits in the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */69 folder Folders foldercontents#include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */67raw source files that make up the final script #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */69raw markdown files that make up #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */72 #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */73server-side bin scripts ( <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>42) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */75dist files for web browsers and nonstandard JS environments #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */4demo projects for platforms like ExtendScript and Webpack #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */77browser tests (run #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */47 to rebuild) #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */79typescript definitions and tests #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */80miscellaneous supporting scripts #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */61test files (pulled from the test files repository) Sau khi nhân bản repo, chạy #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */82 sẽ hiển thị danh sách các lệnh Hệ điều hành/Linux(click to show)The <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>17 file is constructed from the files in the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */67 subdirectory. The build script (run #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */68) will concatenate the individual bits to produce the script. Before submitting a contribution, ensure that running make will produce the <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>17 file exactly. The simplest way to test is to add the script if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */4 To produce the dist files, run #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */87. The dist files are updated in each version release and should not be committed between versions các cửa sổ(click to show)The included #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */88 script will build <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js">script>17 from the #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */67 directory. Building is as simple as if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */5 To prepare development environment if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */6 The full list of commands available in Windows are displayed in #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */82 if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */7 As explained in Test Files, on Windows the release ZIP file must be downloaded and extracted. Nếu Bash trên Windows khả dụng, có thể chạy quy trình làm việc OSX/Linux. Các bước sau chuẩn bị môi trường if(typeof require !== 'undefined') XLSX = require('xlsx'); var workbook = XLSX.readFile('test.xlsx'); /* DO SOMETHING WITH workbook HERE */8 bài kiểm tra(click to show)The #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */92 target ( #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */41 on Linux/OSX / #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */94 on Windows) runs the targeted feature tests. It should take 5-10 seconds to perform feature tests without testing against the entire test battery. New features should be accompanied with tests for the relevant file formats and features Đối với các thử nghiệm liên quan đến mặt đọc, một thử nghiệm tính năng thích hợp sẽ liên quan đến việc đọc một tệp hiện có và kiểm tra đối tượng sổ làm việc kết quả. If a parameter is involved, files should be read with different values to verify that the feature is working as expected For tests involving a new write feature which can already be parsed, appropriate feature tests would involve writing a workbook with the feature and then opening and verifying that the feature is preserved For tests involving a new write feature without an existing read ability, please add a feature test to the kitchen sink #include "xlsx.extendscript.js" /* Read test.xlsx from the Documents folder */ var workbook = XLSX.readFile(Folder.myDocuments + '/' + 'test.xlsx'); /* DO SOMETHING WITH workbook HERE */95 Giấy phépVui lòng tham khảo tệp GIẤY PHÉP đính kèm để biết chi tiết. All rights not explicitly granted by the Apache 2. 0 Giấy phép được bảo lưu bởi Tác giả gốc |