Read Excel file data directly

Source: Internet
Author: User

Objective

Because of the need to directly read the Excel file data, but search on the internet many times did not find a good way,

Usually read through ODBC or OLE, but both of these methods have limitations ... (I believe we all know it).

What do we do? No way, have to choose the most difficult way--analysis of Excel file format.

Introduced

MS Excel is well known for spreadsheet processing software. The Excel file format is a specific Biff (Binary Interchange File format), where many records are stored in Biff, and the record header and the record body are included in the section. The record header is 4byte, the first two digits specify the record type code (opcode), the last two digits specify the record length, and the record body is the actual data that stores the record.

Like what:

BOF record
      | Record Header  |  Record Body  |
Byte    | 0  1  2  3 | 0  1  2  3 |
      -----------------------------------------
Contents  | 09 | 00 | 04 | 00 | 02 | 00 | 10 | 00 |
      -----------------------------------------
      | opcode | length | version | file  |
      |     |     | number | type  |
记录头:
  opcode: 09h is BOF;
  length: 04h record body is 4 bytes long;
记录体:
  version number:02h is version number (2 for the initial version of Excel)
  file type:10h is a worksheet file;
具体可参考MS Excel File Format。

Describe

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.