CN115905384A - Excel spreadsheet data import and export method for realizing multi-level header multi-type data structure - Google Patents
Excel spreadsheet data import and export method for realizing multi-level header multi-type data structure Download PDFInfo
- Publication number
- CN115905384A CN115905384A CN202211458369.8A CN202211458369A CN115905384A CN 115905384 A CN115905384 A CN 115905384A CN 202211458369 A CN202211458369 A CN 202211458369A CN 115905384 A CN115905384 A CN 115905384A
- Authority
- CN
- China
- Prior art keywords
- data
- format
- header
- excel
- date
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Document Processing Apparatus (AREA)
Abstract
The invention discloses an excel spreadsheet data import and export method for realizing a multi-level header multi-type data structure, which realizes data import and export between excel spreadsheet data and a relational database through analysis and coding of a JSON data structure object and an excel cell sheet object; the method comprises the steps of analyzing a tree-shaped hierarchical data structure of a table header, analyzing a data type object of a table column and analyzing a table cell format. The method comprises the steps that a standard and standard data algorithm is customized according to a complex multi-level header structure and various data formats, table data are read and written correctly, and are analyzed and stored in a warehouse through a conversion method of various types of data during data acquisition; and when the excel spreadsheet is output, a standard data structure format conversion method is adopted to correctly output the excel spreadsheet. The advantages are that: the import and export application is wide, and the method is suitable for standard conversion of data among databases; the Excel data format is effectively analyzed and output, and the use experience of Excel and the capability of analyzing and integrating data are improved.
Description
Technical Field
The invention relates to the technical field of automatic acquisition, storage and output of business data, in particular to an excel spreadsheet data import and export method for realizing a multi-level header multi-type data structure.
Background
The data types collected in production are complex, the data formats comprise time stamps, numerical values, texts and the like, the data structure hierarchy is various, various combined structures such as grouping and classification exist, and the data conversion with main stream databases such as Oracle, DB2, sqlServer, access, sybase, mySQL and the like is usually realized by adopting an EXCEL spreadsheet. The traditional data conversion method is to manually convert the original data format in the EXCEL report into the conventional character string type, import the conventional character string type into a production service database, and export a single table structure, and the defects of the method are as follows: the first hand data is produced, the format needs to be manually converted into the conventional format, time and labor are consumed, the efficiency is low, the calculation function of the spreadsheet is lost, the structure of the derived form is simple, and the style is lost.
Disclosure of Invention
The invention aims to provide an excel spreadsheet data import and export method of a multi-level header multi-type data structure, so as to solve the problems in the prior art.
In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
the method for importing and exporting excel spreadsheet data of a multi-level header multi-type data structure realizes data import and export between excel spreadsheet data and a relational database through analysis and coding of JSON data structure objects and excel cell sheet objects; which comprises the steps of (a) preparing a mixture of (b),
A. parsing of the tree-level data structure of the table header: corresponding to a data column object structure, and realizing the construction of a header sheet object of the header;
B. parsing of data type object of column form: when data in the excel spreadsheet are imported into the relational database, a character string format conversion method, a timestamp conversion method and a numerical data conversion method are correspondingly executed by the data; when the data in the relational database is derived into an excel spreadsheet, the data correspondingly executes a character string format conversion method, a date format conversion method and a numerical data format conversion method;
C. parsing of the table cell format: pure JS writing method, extended read and write-in, xlsx workbook cell format; and calculating and constructing an output data object structure by adopting the standard Sheet object attribute for the numeric format character string associated with the cell.
Preferably, the parsing of the tree-level data structure of the table header includes the process of,
a1, customizing a JSON data structure of a standard complex header, defining multi-level column1, column2 and 8230, wherein basic attributes of a column element object of a column N table comprise fields, titles, widths, types, numerical value types, format types and child nodes;
a2, calculating a cell object by adopting a layer-by-layer traversal analysis method of table JSON structural data through a columns object, an index, a hierarchy and a table head node object; the cell object comprises an affiliated row, an affiliated column, an attribute, a title, a form label, an arrangement serial number, a type and a data type;
a3, recursively executing A2, calculating an array set of the cell objects of the whole header node, and constructing a complex multi-level header structure;
a4, through the filtration of the row data and column data objects, the calculation of the table head cell format is realized;
and A5, taking the maximum column number and the maximum level of the header, circularly executing a fromCharCode method, converting the ASCII code value into corresponding characters, and calculating the header filling area.
Preferably, it is characterized in that:
the method for converting the format of the character string comprises the following steps: the method comprises the steps that key values are customized to match a data set [ { key1, value1}, { key2, value2}, \ 8230 ], { key, value } ], column attributes are matched by means of a setRUData function, and column text formats are converted into coding values through one-to-one correspondence between the key values and effective values; executing an import data formatting method setImportTableData, and realizing data import of Chinese character-to-code conversion through key value mapping;
the time stamp conversion method comprises the following steps: data with the types of date and datatime are converted into a date and date time format by adopting a date formatting format date function, and then a format function is called to convert the data into a date format matched with dataformat; executing a format times function for data with the type of time, and converting the data into a time character string with the type of HH mm: ss;
the numerical data conversion method comprises the following steps: the Excel cell is numerical data, displays the format, and converts the data into Number type according to the precision to realize data import.
Preferably, it is characterized in that:
the method for converting the character string format comprises the following steps: the method comprises the steps that key values are customized to match a data set [ { key1, value1}, { key2, value2}, \ 8230 ], { key, value } ], column attributes are matched by means of a setRUData function, and column code values are converted into text formats in a one-to-one correspondence mode of the key values and effective values; executing a exported data formatting method setExportTableData, and realizing the export of data of code-to-Chinese characters through key value mapping;
the date format conversion method comprises the following steps: for data, z text formatting and table column columns objects with the types of date or datetime, adopting excel self-defined date display digital format for the standard format of date and time output, converting date and time character strings into date and time types to be exported, and calculating the time and date display format of z; the date display number format includes "yyyy-MM-dd", "yyyyy/MM/dd", \ 8230 "," yyyyy-MM-ddHH: MM: ss ",
the numerical data format conversion method comprises the following steps: the numerical data adopts excel self-defined numerical display numerical format, realizes format conversion of the numerical data, judges numerical character strings, and occupies positions in sequence as positive and negative numbers, integer numbers and decimal precision, thereby calculating the numerical format of z; the numerical value display numerical format includes a numerical value of "0.00%", a positive number of "#, # # 00", a negative number of "- #, # # 00", and a zero of "0.00";
z represents a numeric format string associated with a cell.
Preferably, the process of importing the data in the excel spreadsheet into the relational database is as follows,
analyzing a table header structure of the excel electronic table by adopting a layer-by-layer traversal analysis method of table JSON structure type data, acquiring a table column object, reading data from the table and establishing a corresponding relation with the table column object, adding a data filtering method according to the type of the column, checking and filtering data with the same name, executing a spreadsheet data conversion function, converting different types of data in the excel electronic table into correct data types and importing the data types into a relational database.
Preferably, the process of exporting the data in the relational database into the excel spreadsheet is,
s21, the custom header structure header transmits parameters through a multiple header function, recursively executes the function, and analyzes, analyzes and calculates to obtain a minimum unit cell structure; the parameters comprise table data objects, indexes of columns, line numbers, sequence numbers of sub-objects, cell objects and whether cells exist or not;
s22, traversing the table head columns, constructing cell data corresponding to the table heads, merging cell objects, replacing the previous column data of the rows with the same packet serial number, calculating a table head area, and filtering to generate a multi-layer JSON array structure;
s23, traversing the table object, executing a getCellTypeMultiu cell data conversion method, and performing data type conversion on each line of data by adopting a character string format conversion method and/or a date format conversion method and/or a numerical data format conversion method;
and S24, sequentially writing the table cell Sheets objects calculated in the steps into a header filling area, converting the data into blob binary stream data and exporting the blob binary stream data into an excel file.
The beneficial effects of the invention are: 1. the method adopts Vue + Element + xlsx + JS-xlsx technology and JS method to analyze and compile spreadsheet data structure, and supports the output of multiple excel data formats. 2. Aiming at a complex multi-level header structure and various data formats, a data algorithm with a custom standard specification is adopted, table data can be read and written correctly, and the table data is analyzed and stored in a warehouse through a conversion algorithm of various data types during data acquisition; and outputting a format analysis algorithm adopting a standard data structure, and correctly outputting the excelL spreadsheet.
Drawings
FIG. 1 is a schematic diagram of data import and export in an embodiment of the present invention;
FIG. 2 is a JSON structure-sheet conversion structure diagram in the embodiment of the invention;
FIG. 3 is a diagram of an attribute structure of a complex tree cell in an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the invention, are intended for purposes of illustration only and are not intended to limit the scope of the invention.
Example one
As shown in fig. 1 to fig. 3, in the present embodiment, an excel spreadsheet data import/export method for implementing a multi-hierarchy header multi-type data structure is provided, and data import/export between excel spreadsheet data and a relational database is implemented by parsing and encoding a JSON data structure object and an excel cell sheet object.
The invention realizes the batch collection of data through the introduction of the excel, provides a function conversion algorithm conforming to a relational database data structure aiming at the time and date, the floating point type data and the text data structure of the excel, and ensures the accurate collection of business production data. Through a multi-header analysis method and a structure conversion method of a data display format, XLSXStyle is adopted to realize the Worksheet data object conversion with Excel, and the editing of a table header object and a table style and the table output with the format are supported. The function of importing and exporting complex header table data of various data types, band styles and formats is realized through the following three technical principles:
A. parsing of the tree-level data structure of the table header: corresponding to the structure of a data column object, and realizing the construction of a header sheet object of the header;
B. parsing of data type object of column form: when data in the excel spreadsheet are imported into the relational database, a character string format conversion method, a timestamp conversion method and a numerical data conversion method are correspondingly executed by the data; when the data in the relational database is derived into an excel spreadsheet, the data correspondingly executes a character string format conversion method, a date format conversion method and a numerical data format conversion method;
C. parsing of the table cell format: pure JS writing method, expanded reading and writing, and cell format of xlsx workbook; and calculating and constructing an output data object structure by adopting the standard Sheet object attribute to the numeric format character string associated with the cell.
Standard Sheet object property: v original value, w formatted text, z numeric format string associated with a cell, s style theme for a cell.
In the embodiment, the tree-level data structure analysis for the table header comprises the following processes,
a1, customizing a JSON data structure of a standard complex header, defining multiple levels of column1, column2 and 8230, wherein basic attributes of a column element object of a column N table comprise field, title, width, type, numerical type, format type and child node child;
a2, calculating a cell object of a cell by adopting a layer-by-layer traversal analysis method of table JSON structural data through a columns object, an index, a hierarchy and a table head node object; the cell object comprises a belonging row c, a belonging column t, an attribute prop, a title, a form label formlabel, a sequence number orderid, a type and a data type datatype;
a3, recursively executing the A2, calculating an array set of the cell objects of the whole header node, and constructing a complex multi-level header structure;
a4, filtering the data objects of the row and the column to realize the header! Calculating a mergs cell format;
a5, taking the maximum column number and the maximum level of the header, circularly executing a fromCharCode method, converting the ASCII code value into corresponding characters, and calculating the header! ref fills the area.
In the embodiment, when data import is realized, different conversion methods are selected for different types of data to realize data conversion. The method specifically comprises the following three steps:
1. the method for converting the format of the character string comprises the following steps: customizing key value matching data sets [ { key1, value1}, { key2, value2}, \ 8230 { key, value } ], matching column attributes by using a setRUData function, and converting a column text format into a coding value through one-to-one correspondence of the key values and the effective values; executing an import data formatting method setImportTableData, and realizing data import of Chinese character-to-code conversion through key value mapping;
2. the time stamp conversion method comprises the following steps: data with the types of date and datatime are converted into a date and date time format by adopting a date formatting format date function, and then a format function is called to convert the data into a date format matched with dataformat; executing a format times function for data with the type of time, and converting the data into a time character string with the type of HH mm: ss;
3. the numerical data conversion method comprises the following steps: the Excel cell is numerical data, displays the format, and realizes data import by converting the Excel cell into a Number type according to precision.
In this embodiment, in the process of implementing data export, different conversion methods are selected to implement data conversion according to different types of data. The method specifically comprises the following three steps:
1. the method for converting the character string format comprises the following steps: the method comprises the steps that key values are customized to match a data set [ { key1, value1}, { key2, value2}, \ 8230 ], { key, value } ], column attributes are matched by means of a setRUData function, and column code values are converted into text formats in a one-to-one correspondence mode of the key values and effective values; executing a exported data formatting method setExportTableData, and realizing the export of data of code-to-Chinese characters through key value mapping;
2. the date format conversion method comprises the following steps: for data, z text formatting and table column columns objects with the types of date or datetime, adopting excel self-defined date display digital format for the standard format of date and time output, converting date and time character strings into date and time types to be exported, and calculating the time and date display format of z; the date display number format includes "yyyy-MM-dd", "yyyyy/MM/dd", \ 8230 "," yyyyy-MM-dd HH: MM: ss ",
3. the numerical data format conversion method comprises the following steps: the numerical data adopts an excel-defined numerical display numerical format to realize format conversion of the numerical data, numerical character strings are judged, and the positions are occupied as positive and negative numbers, integer numbers and decimal precision in sequence, so that the numerical format of z is calculated; the numerical value display numerical format includes a numerical value of "0.00%", a positive number of "#, # # 00", a negative number of "- #, # # 00", and a zero of "0.00";
z represents a numeric format string associated with a cell.
Example two
In this embodiment, referring to the data import and export flow shown in fig. 1, the method of the present invention realizes data conversion between an Excel spreadsheet and mainstream production service databases such as oracle and mysql by a method of interconversion between a JSON database structure and an Excel data structure of JSON-to-Sheet, and assists in production data acquisition, data processing, and data application management.
Referring to fig. 3, the array structure of javascript objects is analyzed and generated by a machine in a JSON tree type data exchange format of a simple and complex multi-level table header, is convenient to read and write, and is a basic data object for importing and exporting Excel spreadsheet data.
header=[{columns1…},{columns2…,children[{columns21…}]},{children:[{children:[{children:[]}];
The invention constructs and generates a table data column object by a header analysis method, the attribute of the table column is a standard structure of data processing, the transmission and the acquisition of the table data are bidirectional, and different analysis and conversion algorithms are adopted in the data circulation process.
The Excel data import and export and the corresponding conversion calculation method are specifically described below by referring to examples.
1. Data import relational database in excel spreadsheet
Analyzing a table header structure of the excel electronic table by adopting a layer-by-layer traversal analysis method of table JSON structure type data, acquiring a table column object, reading data from the table and establishing a corresponding relation with the table column object, adding a data filtering method according to the type of the column, checking and filtering data with the same name, executing a spreadsheet data conversion function, converting different types of data in the excel electronic table into correct data types and importing the data types into a relational database.
The data type datatype of the table column comprises three types, namely character strings, numerical values and date and time (String, number, datetime, time and date), and corresponds to three conversion algorithms, and the Excel table data is loaded by reading the filesread and is analyzed by adopting the conversion algorithms. And the setJulleData and setImportRows functions acquire the transcoding key value set and perform conversion calculation.
(1) The character string format conversion method comprises the following steps: for special service application, data automatically generated by a machine needs to be converted into codes for storage, key values are customized to match a data set [ { key1, value1}, { key2, value2}, \8230 { (keyn, value } ], a setReData function is utilized to match column attributes, and a column text format is converted into a code value through one-to-one correspondence between the key values and effective values. And executing an import data formatting method, namely setImportTableData (row), row data and key value mapping to realize data storage of Chinese character encoding.
(2) The time stamp conversion method comprises the following steps: the date and time of the Excel cell shows standard formatted time, the actually imported floating-point timestamp timesmap is used, and the data imported in the date and time format needs to be converted into a date and time character string for storage.
The datatype is data of date and datatime type, a date formatting format date function is called to convert the data into a date and date time format, a 5-bit time format is converted into a time stamp, and then the format function is called to convert the data into a date format matched with the dataformat.
Executing a format times function for data with the datatype type being time, wherein the data is floating point number, the format value is format style, and the data is converted into HH mm ss time character string of the time;
(3) Numerical type: the Excel cell is numerical data, displays the format, and is converted into the Number type according to the precision.
2. Exporting data in a relational database into excel spreadsheets
The data export and import principle is the same, the export data also adopts a table header analysis method to obtain the table column object, and the data export of the database into the Excel report has three steps.
1. Analyzing the table header format: the customized header structure header transmits parameters through a multiple header function, recursively executes the function, and analyzes, analyzes and calculates to obtain a minimum unit cell structure; the parameters comprise a table data object tablebel, an index of a column, a line number t, a sub-object serial number orderid, a cell object tablehead and whether a cell exists or not;
tableitem={"c":index,"t":t,"prop":prop,"title":title,"orderid1":ordered"type":type,"dataType":datetype,"width":width,"mergs":{"s":{"c":2,"r":1},"e":{"c":5,"r":1}}
wherein c is a line number, t is a column number, prop is an attribute value, title is a title, type is a node type, datetype is a data type, width is a column width, mergs is a merged cell object, and s and e are merged cell start and end coordinate values respectively.
2. Traversing the table head columns, constructing cell data corresponding to the table heads, merging cell objects, replacing the column data of the c groups with the same sequence number, calculating the table head area, and filtering to generate a multi-layer JSON array structure;
wherein Font is Font color size, alignment is text horizontal or vertical centering, fill is filling color, and border is border line size color style.
3. And (3) exporting data type conversion: traversing the table object, executing a getCellTypeMultiu cell data conversion method, and performing data type conversion on each line of data by adopting a character string format conversion method and/or a date format conversion method and/or a numerical data format conversion method:
(1) The method for converting the character string format comprises the following steps: when the database coding is required to be converted into the display text export, key value matching data sets [ { key1, value1}, { key2, value2}, \ 8230 [ { key, value } ] are customized, a setRUData function is used for matching column attributes, and the column coding values are converted into text formats through one-to-one correspondence of key values and valid values. And performing data formatting derived from setExportTableData (tabledata), wherein tabledata is table line data, and realizing coding-to-Chinese character output through key value mapping.
(2) The data format conversion method comprises the following steps: the Number numerical data is in a Excel self-defined display digital format, numerical data formatting is realized, the numerical self-defined format is '0.00%', positive numbers '#, # # 00', negative numbers '- #, # # 00', zero '0.00', numerical character strings are judged, the positions are occupied in sequence into positive and negative numbers, integer numbers and decimal precision, and the numerical format of z is calculated.
(3) The date format conversion method comprises the following steps: the type is date, the type of datetime, the formatting of z text, the table column objects, the attribute dateFormat is the standard format of date and time output, yyyy-MM-dd, yyyy/MM/dd, and \ 8230, yyyy-MM-dd HH: MM: ss are selected, the derivation of date and time character string-to-date and time type is realized through the Excel self-defined display digital format, and the time and date display format of z is calculated.
4. Sequentially writing the table cell objects calculated in the above steps into a header filling area! And ref, converting the data into blob binary stream data and exporting the blob binary stream data into an excel file.
By adopting the technical scheme disclosed by the invention, the following beneficial effects are obtained:
the invention provides an excel spreadsheet data import and export method for realizing a multi-level header and multi-type data structure. Aiming at a complex multi-level header structure and various data formats, a data algorithm with a custom standard specification is adopted, table data can be read and written correctly, and the table data is analyzed and stored in a warehouse through a conversion algorithm of various data types during data acquisition; and outputting a format analysis algorithm adopting a standard data structure, and correctly outputting the excelL spreadsheet.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and improvements can be made without departing from the principle of the present invention, and such modifications and improvements should also be considered within the scope of the present invention.
Claims (6)
1. An excel spreadsheet data import and export method for realizing a multi-level header multi-type data structure comprises the following steps: data import and export between excel spreadsheet data and a relational database are realized through the analysis and coding of a JSON data structure object and a cell sheet object of excel; which comprises the steps of (a) preparing a mixture of,
A. parsing of the tree-level data structure of the table header: corresponding to a data column object structure, and realizing the construction of a header sheet object of the header;
B. parsing of data type object of table column: when data in the excel spreadsheet are imported into the relational database, a character string format conversion method, a timestamp conversion method and a numerical data conversion method are correspondingly executed by the data; when the data in the relational database is derived into an excel spreadsheet, the data correspondingly executes a character string format conversion method, a date format conversion method and a numerical data format conversion method;
C. parsing of the table cell format: pure JS writing method, expanded reading and writing, and cell format of xlsx workbook; and calculating and constructing an output data object structure by adopting the standard Sheet object attribute to the numeric format character string associated with the cell.
2. The method for importing and exporting excel spreadsheet data implementing a multi-level header multi-type data structure according to claim 1, wherein: the parsing of the tree-level data structure of the table header includes the following processes,
a1, customizing a JSON data structure of a standard complex header, defining multi-level column1, column2 and 8230, wherein basic attributes of a column element object of a column N table comprise fields, titles, widths, types, numerical value types, format types and child nodes;
a2, calculating a cell object by adopting a layer-by-layer traversal analysis method of table JSON structural data through a columns object, an index, a hierarchy and a table head node object; the cell object comprises a belonging row, a belonging column, an attribute, a title, a form label, an arrangement serial number, a type and a data type;
a3, recursively executing A2, calculating an array set of the cell objects of the whole header node, and constructing a complex multi-level header structure;
a4, through the filtration of the row data and column data objects, the calculation of the table head cell format is realized;
and A5, taking the maximum column number and the maximum level of the header, circularly executing a fromCharCode method, converting the ASCI I code value into a corresponding character, and calculating the header filling area.
3. The method for importing and exporting excel spreadsheet data implementing a multi-level header multi-type data structure according to claim 1, wherein:
the method for converting the format of the character string comprises the following steps: customizing key value matching data sets [ { key1, value1}, { key2, value2}, \ 8230 { key, value } ], matching column attributes by using a setRUData function, and converting a column text format into a coding value through one-to-one correspondence of the key values and the effective values; executing an import data formatting method setImportTableData, and realizing data import of Chinese character-to-code conversion through key value mapping;
the time stamp conversion method comprises the following steps: data with the types of date and datatime are converted into a date and date time format by adopting a date formatting format date function, and then a format function is called to convert the data into a date format matched with dataformat; executing a format times function for data with the type of time, and converting the data into a time character string with the type of HH mm: ss;
the numerical data conversion method comprises the following steps: the Excel cell is numerical data, displays the format, and converts the data into Number type according to the precision to realize data import.
4. The method for importing and exporting excel spreadsheet data implementing a multi-level header multi-type data structure according to claim 1, wherein:
the method for converting the character string format comprises the following steps: the method comprises the steps that key values are customized to match a data set [ { key1, value1}, { key2, value2}, \ 8230 ], { key, value } ], column attributes are matched by means of a setRUData function, and column code values are converted into text formats in a one-to-one correspondence mode of the key values and effective values; executing a exported data formatting method setExportTableData, and realizing the export of data of code-to-Chinese characters through key value mapping;
the date format conversion method comprises the following steps: for data of a date type or a datetime type, z text formatting and table column columns, the attribute dateFormat of a standard format for date and time output is in an excel self-defined date display digital format, so that a date and time character string is converted into a date and time type to be exported, and a z time and date display format is calculated; the date display number format includes "yyyy-MM-dd", "yyyyy/MM/dd", \ 8230 "," yyyyy-MM-dd HH: MM: ss ",
the numerical data format conversion method comprises the following steps: the numerical data adopts excel self-defined numerical display numerical format, realizes format conversion of the numerical data, judges numerical character strings, and occupies positions in sequence as positive and negative numbers, integer numbers and decimal precision, thereby calculating the numerical format of z; the numerical value display numerical format includes a numerical value of "0.00%", a positive number of "#, #.00", a negative number of "- #, #.00", and a zero of "0.00";
z represents a numeric format string associated with a cell.
5. The method for importing and exporting excel spreadsheet data implementing a multi-level header multi-type data structure according to claim 1, wherein: the process of importing the data in the excel spreadsheet into the relational database is as follows,
analyzing a table header structure of the excel electronic table by adopting a layer-by-layer traversal analysis method of table JSON structure type data, acquiring a table column object, reading data from the table and establishing a corresponding relation with the table column object, adding a data filtering method according to the type of the column, checking and filtering data with the same name, executing a spreadsheet data conversion function, converting different types of data in the excel electronic table into correct data types and importing the data types into a relational database.
6. The method for importing and exporting excel spreadsheet data implementing a multi-level header multi-type data structure according to claim 1, wherein: the process of exporting data in the relational database into an excel spreadsheet is,
s21, the custom header structure header transmits parameters through a multiple header function, recursively executes the function, and analyzes, analyzes and calculates to obtain a minimum unit cell structure; the parameters comprise table data objects, indexes of columns, line numbers, sequence numbers of sub-objects, cell objects and whether cells exist or not;
s22, traversing the table head columns, constructing cell data corresponding to the table heads, merging cell objects, replacing the previous column data of the rows with the same packet serial number, calculating a table head area, and filtering to generate a multi-layer JSON array structure;
s23, traversing the table object, executing a getCellTypeMultiu cell data conversion method, and performing data type conversion on each line of data by adopting a character string format conversion method and/or a date format conversion method and/or a numerical data format conversion method;
and S24, sequentially writing the table cell Sheets objects calculated in the steps into a header filling area, converting the data into blob binary stream data and exporting the blob binary stream data into an excel file.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211458369.8A CN115905384A (en) | 2022-11-16 | 2022-11-16 | Excel spreadsheet data import and export method for realizing multi-level header multi-type data structure |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211458369.8A CN115905384A (en) | 2022-11-16 | 2022-11-16 | Excel spreadsheet data import and export method for realizing multi-level header multi-type data structure |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115905384A true CN115905384A (en) | 2023-04-04 |
Family
ID=86478162
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211458369.8A Pending CN115905384A (en) | 2022-11-16 | 2022-11-16 | Excel spreadsheet data import and export method for realizing multi-level header multi-type data structure |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115905384A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117422562A (en) * | 2023-12-18 | 2024-01-19 | 凯美瑞德(苏州)信息科技股份有限公司 | Method and device for processing financial data |
-
2022
- 2022-11-16 CN CN202211458369.8A patent/CN115905384A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117422562A (en) * | 2023-12-18 | 2024-01-19 | 凯美瑞德(苏州)信息科技股份有限公司 | Method and device for processing financial data |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110637291B (en) | Efficient use of TRIE data structures in databases | |
CN103823823B (en) | Denormalization policy selection method based on Frequent Itemsets Mining Algorithm | |
US20210149926A1 (en) | Identifying data relationships from a spreadsheet | |
CN115905384A (en) | Excel spreadsheet data import and export method for realizing multi-level header multi-type data structure | |
US20050010566A1 (en) | System and method of multidimensional query results processing | |
CN110738027B (en) | Computer-implemented method, apparatus, and storage medium for generating spreadsheet formulas | |
CN111104525B (en) | Construction method of building design specification knowledge graph based on graph database | |
CN108647319A (en) | A kind of labeling system and its method based on short text clustering | |
CN105005592B (en) | Data dictionary generation method and data dictionary creation device | |
CN102737108B (en) | Method and device for processing flow diagram | |
US20190377801A1 (en) | Relational data model for hierarchical databases | |
CN113822037B (en) | Method, device, equipment and medium for inserting placeholder and generating data mapping table | |
CN107391678A (en) | Web page content information extracting method based on cluster | |
CN111026815B (en) | Entity pair specific relation extraction method based on user-assisted correction | |
CN108536683A (en) | A kind of paper fragmentation information abstracting method based on machine learning | |
CN111833981A (en) | Structured report making and compiling method | |
CN108509397A (en) | Storage, analytic method and the system of hierarchical structure data based on identifier technology | |
CN114896466A (en) | Method, system, medium, and computer device for automatically matching field names of well files having field names | |
CN108366050A (en) | A kind of common communication protocol processing method | |
CN114372174A (en) | XML document distributed query method and system | |
CN112148735B (en) | Construction method for structured form data knowledge graph | |
CN102087666B (en) | Indexes based on covering relationship between nodes and key words, constructing method and query method thereof | |
CN112380826B (en) | Formatting electronic form generating method based on text file | |
CN115934715A (en) | Tabular construction method of program data structure | |
CN114896352B (en) | Method, system, medium and computer device for automatically matching field names of well files without field names |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |