CN115983222A - EasyExcel-based file data reading method, device, equipment and medium - Google Patents

EasyExcel-based file data reading method, device, equipment and medium Download PDF

Info

Publication number
CN115983222A
CN115983222A CN202310265044.6A CN202310265044A CN115983222A CN 115983222 A CN115983222 A CN 115983222A CN 202310265044 A CN202310265044 A CN 202310265044A CN 115983222 A CN115983222 A CN 115983222A
Authority
CN
China
Prior art keywords
file
reading
data
excel
custom
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
Application number
CN202310265044.6A
Other languages
Chinese (zh)
Inventor
舒伟
包先铭
董汉
陈超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Tsing Standard Automobile Technology Co ltd
Original Assignee
Suzhou Tsing Standard Automobile Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Suzhou Tsing Standard Automobile Technology Co ltd filed Critical Suzhou Tsing Standard Automobile Technology Co ltd
Priority to CN202310265044.6A priority Critical patent/CN115983222A/en
Publication of CN115983222A publication Critical patent/CN115983222A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a file data reading method, a device, equipment and a medium based on easy excel. The method comprises the following steps: after a data reading request is received, determining a target Excel file corresponding to the data reading request; analyzing a target Excel file line by calling a custom file reading abstract monitoring class according to a custom line reading method to obtain a file analysis result, wherein the custom file reading abstract monitoring class inherits an event analysis monitoring class which is used for analyzing the analyzed Excel file in an easy Excel frame; and carrying out data reading processing on the file analysis result by calling a built-in data reading method of the easy Excel frame so as to realize the reading of the data in the target Excel file. According to the technical scheme of the embodiment of the invention, the data in the Excel file can be read more conveniently and flexibly, and the user requirements can be effectively responded.

Description

Easyexcel-based file data reading method, device, equipment and medium
Technical Field
The invention relates to the technical field of computers, in particular to a file data reading method, device, equipment and medium based on easy excel.
Background
In project development, file processing is often involved, and the reading speed of files generally influences the project development cycle. The easy Excel frame is an open-source Excel processing frame, can quickly complete the functions of reading, writing and the like of Excel without considering factors such as performance, memory and the like, and is popular with technical personnel.
In the related art, the easy excel frame is used for reading the file, and usually, a business object is created under the condition of a fixed business scene, and the file is read by taking the business object as a bridge. Once the business scene is ambiguous and the fields in the business object are uncertain, the file cannot be read by using the easy excel framework. Therefore, the technical problems of poor flexibility and convenience exist in the existing method for reading files by using an easy excel frame, and user experience is influenced.
Disclosure of Invention
The invention provides a file data reading method, device, equipment and medium based on easy Excel, so that data in an Excel file can be read conveniently and flexibly, user requirements can be responded effectively, and user experience is improved.
According to an aspect of the present invention, there is provided an easy excel-based file data reading method, including:
after a data reading request is received, determining a target Excel file corresponding to the data reading request;
analyzing the target Excel file line by calling a custom file reading abstract monitoring class according to a custom line reading method to obtain a file analysis result, wherein the custom file reading abstract monitoring class inherits an event analysis monitoring class which is used for analyzing the analyzed Excel file in an easy Excel frame;
and carrying out data reading processing on the file analysis result by calling a built-in data reading method of the easy Excel frame so as to realize the reading of the data in the target Excel file.
According to another aspect of the invention, an easy excel-based file data reading device is provided. The device includes:
the file determining module is used for determining a target Excel file corresponding to a data reading request after the data reading request is received;
the file analysis module is used for analyzing the target Excel file line by calling a custom file reading abstract monitoring class according to a custom line reading method to obtain a file analysis result, wherein the custom file reading abstract monitoring class inherits an event analysis monitoring class used for analyzing the analyzed Excel file in an easy Excel frame;
and the file reading module is used for carrying out data reading processing on the file analysis result by calling a built-in data reading method of the easy Excel frame so as to realize the reading of the data in the target Excel file.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform any of the easy excel based file data reading methods of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to implement any of the easy excel-based file data reading methods of the present invention when executed.
According to the technical scheme of the embodiment of the invention, after the data reading request is received, the target Excel file corresponding to the data reading request is determined. A user-defined file reading abstract monitoring class is defined by inheriting an event analyzing monitoring class used for analyzing an analyzed Excel file in an easy Excel frame, and a user-defined line-by-line reading method is defined in the user-defined file reading abstract monitoring class. And then the user-defined line-by-line reading method in the abstract monitoring class is read by calling the user-defined file, the target Excel file is analyzed and processed line-by-line, and the file can be flexibly read by using the underlying logic of the easy Excel frame. Thereby obtaining a file analysis result. And then, carrying out data reading processing on the file analysis result by calling a built-in data reading method of the easy Excel frame so as to realize the reading of the data in the target Excel file. According to the technical scheme of the embodiment of the invention, the data in the Excel file can be conveniently and flexibly read, the user requirements can be effectively responded, and the user requirements are improved.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a file data reading method based on easy excel according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a file data reading method based on easy excel according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an easy excel-based file data reading apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It will be appreciated that the data involved in the subject technology, including but not limited to the data itself, the acquisition or use of the data, should comply with the requirements of the corresponding laws and regulations and related regulations.
Example one
Fig. 1 is a schematic flowchart of a document data reading method based on easy excel according to an embodiment of the present invention, where the embodiment is applicable to a case where an easy excel frame is used to read data in a document, the method may be executed by an easy excel-based document data reading apparatus, the easy excel-based document data reading apparatus may be implemented in a form of hardware and/or software, and the easy excel-based document data reading apparatus may be configured in an electronic device such as a computer or a server.
As shown in fig. 1, the method of the present embodiment includes:
s110, after receiving a data reading request, determining a target Excel file corresponding to the data reading request.
The data reading request can be understood as a request for reading data in a target Excel file. The data reading request can comprise the file identification of the target Excel file. Optionally, the file identification may include at least one of a file code, a file name, and a file path. It should be noted that the file path may be understood as a storage location of the file. Alternatively, the file path may be a relative file path and an absolute file path. The target Excel file can be understood as an Excel file which needs to be subjected to data reading.
Specifically, after a data reading request is received, a storage space for storing an Excel file can be determined. So that the Excel file matched with the data read request can be matched from the storage space for storing the Excel file. In the case of matching to an Excel file, the matched Excel file may be taken as a target Excel file.
On the basis of the embodiment, under the condition of the unmatched Excel file, the prompt message of the unmatched Excel file can be generated, so that under the condition of reading failure of the Excel file data, the reason of data failure in the Excel file can be located in time.
Optionally, the matching, from the storage space for storing the Excel file, the Excel file matched with the data read request may include: the data reading request is analyzed, so that the first file identification in the data reading request can be determined. And a second file identification for each Excel file in the storage space for storing the Excel files. And carrying out consistency comparison on the second file identification and the first file identification.
The first file identifier may be understood as a file identifier included in the data read request. The second file identifier may be understood as a file identifier of an Excel file in a storage space for storing the Excel file. It can be understood that, if the comparison is consistent, the Excel file identified by the second file is taken as a target Excel file. If the comparison is inconsistent, it can be determined that the Excel file identified by the second file is not the target Excel file.
In the embodiment of the present invention, there are various ways to obtain the data read request. For example, the data reading request input by the user can be received; alternatively, the data reading request may be generated in response to a file reading trigger operation of the user. The file reading trigger operation can be understood as a trigger operation for reading an Excel file. Alternatively, the file reading trigger operation may be a control trigger operation (e.g., clicking, sliding) acting on a preset control.
And S120, analyzing the target Excel file in a line-by-line manner by calling a custom file reading abstract monitoring class to obtain a file analysis result, wherein the custom file reading abstract monitoring class inherits an event analysis monitoring class used for analyzing the analyzed Excel file in an easy Excel frame.
In the embodiment of the present invention, the custom file reading abstract listening class may be a predefined abstract listening class inherited to the event parsing listening class in the easy excel framework. The event parsing monitoring class in the easy Excel frame can be used for parsing an parsed Excel file. The custom file reading abstract listening class can be used for analyzing and processing Excel files according to rows. The custom file reading abstract monitoring class comprises a custom line-by-line reading method. The custom read-by-line method can be understood as a predefined method for analyzing an Excel file by line. Optionally, the custom line-by-line reading method may be obtained by duplicating a file reading method in the event analysis monitoring class in the easy excel frame. The file analysis result can be obtained by calling a custom file reading abstract monitoring class to perform custom line-by-line analysis processing on the target Excel file.
Specifically, an abstract monitoring class of an event parsing monitoring class inherited in an easy Excel framework for parsing an Excel file is predefined, namely, a custom file reading abstract monitoring class is predefined. And predefining a custom line-by-line reading method in the custom file reading abstract monitoring class. Based on the method, the target Excel file can be analyzed and processed line by calling a custom line reading method in a custom file reading abstract monitoring class. Thereby obtaining the file analysis result.
S130, carrying out data reading processing on the file analysis result by calling a built-in data reading method of the easy Excel frame so as to realize the reading of the data in the target Excel file.
The built-in data reading method can be understood as a data reading method included in an easy excel framework. The built-in data reading method can be used for carrying out data reading processing on the file analysis result of the target Excel file.
Specifically, the analysis result is used as an actual parameter and is transmitted to a form parameter of a built-in data reading method of the easy excel frame. After the parameter transfer is completed, the built-in data reading method may be performed. And further, data reading processing can be carried out on the file analysis result by executing the built-in data reading method, so that the data in the target Excel file can be read.
On the basis of the foregoing embodiment, after performing data reading processing on the file parsing result, the method may further include: reading a data storage method in the abstract monitoring class by calling the custom file, and storing the read data into a preset data set; and storing the data in the preset data set to a preset database.
The user-defined file reading abstract monitoring class comprises a data storage method. The data storage method may be predefined for performing storage processing on the read data. The preset data set can be understood as a predefined data set for storing data in the target Excel file. Alternatively, the predetermined data set may be a List set. The preset database can be understood as a database with preset configuration for storing data in the target Excel file. In the embodiment of the present invention, the preset database may be configured according to actual requirements, and is not specifically limited herein, for example, the preset database may be an Oracle database, an ACCESS database, a SqlServer database, or a MySQL database.
Specifically, a data storage method is defined in a custom file reading abstract monitoring class in advance. After the data reading processing is performed on the file analysis result, a data storage method in the user-defined file reading abstract monitoring class can be called. And then, a data storage method in the abstract monitoring class can be read by calling the custom file, the read data is stored into a preset data set, and data in the preset data set is stored into a preset database.
On the basis of the above embodiment, the custom file reading abstract monitoring class may include a preset single data storage amount; the preset single data storage amount may be set according to actual needs, for example, the preset single data storage amount may be 5, 10, or 15. The storing the data in the preset data set to a preset database may include: and under the condition that the total amount of data stored in a preset data set reaches the preset single data storage amount, storing the data stored in the preset data set into a preset database.
Specifically, the total amount of data stored in the preset data set is determined. And comparing the total quantity with a preset single data storage quantity. And storing the data stored in the preset data set into a preset database under the condition that the total amount reaches the preset single data storage amount.
On the basis of the foregoing embodiment, after storing the data stored in the preset data set in a preset database, the method may further include: and clearing the data stored in the preset data set, so that the memory recovery is facilitated.
According to the technical scheme of the embodiment of the invention, after the data reading request is received, the target Excel file corresponding to the data reading request is determined. A user-defined file reading abstract monitoring class is defined by inheriting an event analyzing monitoring class used for analyzing an analyzed Excel file in an easy Excel frame, and a user-defined line-by-line reading method is defined in the user-defined file reading abstract monitoring class. And then, a custom line-by-line reading method in the abstract monitoring class is read by calling the custom file, the target Excel file is analyzed and processed line-by-line, and the file can be flexibly read by using the bottom layer logic of the easy Excel frame. Thereby obtaining a file analysis result. And then, carrying out data reading processing on the file analysis result by calling a built-in data reading method of the easy Excel frame so as to realize the reading of the data in the target Excel file. According to the technical scheme of the embodiment of the invention, the data in the Excel file can be conveniently and flexibly read, the user requirements can be effectively responded, and the user requirements are improved.
Example two
Fig. 2 is a schematic flow chart of a file data reading method based on easy Excel according to a second embodiment of the present invention, and on the basis of the foregoing embodiment, optionally, the analyzing processing by rows is performed on the target Excel file by invoking a custom read-by-rows method in a custom file read abstract listening class, including: determining a service processing class corresponding to the data reading request, wherein the service processing class comprises a file import interface; loading the target Excel file by calling the file import interface; and analyzing the loaded target Excel file by line by calling a custom line-by-line reading method in the custom file reading abstract monitoring class. The technical terms that are the same as or corresponding to the above embodiments are not repeated herein.
As shown in fig. 2, the method of this embodiment specifically includes:
s210, after receiving a data reading request, determining a target Excel file corresponding to the data reading request.
S220, determining a service processing class corresponding to the data reading request, wherein the service processing class comprises a file import interface.
The service processing class may be understood as a predefined class for performing service processing. The service processing class includes a file import interface, and it can be understood that the file import interface is defined in the service processing class. The file import interface can be used for loading a target Excel file corresponding to the data reading request.
In one embodiment, the data reading request is parsed, so that the service information corresponding to the data reading request can be determined. And then, according to the corresponding relationship between the preset service information and the service processing class, determining the service processing class corresponding to the service information, that is, determining the service processing class corresponding to the data reading request.
And S230, loading the target Excel file by calling the file import interface.
In this embodiment of the present invention, the loading the target Excel file by calling the file import interface may include: and initializing the file import object of the file import interface by calling the construction method of the user-defined file reading abstract monitoring class. And then calling a file saving method of the file import interface based on the initial file import object, and loading and saving the target Excel file.
The file import object may be an object predefined in a file import interface, and may be used to invoke a file saving method of the file import interface, and load and save the target Excel file. The construction method in the custom file reading abstract interception class can be used for initializing the file import object of the file import interface.
In the embodiment of the invention, the file import object of the file import interface is initialized by calling the construction method of the user-defined file reading abstract monitoring class, and a space can be allocated for the file import object so as to load and store the target Excel file.
S240, analyzing the loaded target Excel file line by calling a custom line reading method in the custom file reading abstract monitoring class to obtain a file analyzing result, wherein the custom file reading abstract monitoring class inherits an event analyzing monitoring class which is used for analyzing the analyzed Excel file in an easy Excel frame.
In this embodiment of the present invention, the analyzing the loaded target Excel file by line by calling the custom line-by-line reading method in the custom file reading abstract monitoring class may include: and transferring the loaded target Excel file to the entry parameter of the custom line-by-line reading method in the custom file reading abstract monitoring class. And after the parameter transmission is finished, calling a custom line-by-line reading method in the custom file reading abstract monitoring class, and analyzing and processing the target Excel file line-by-line.
The entry parameter of the customized row-by-row reading method can be understood as a form parameter of the customized row-by-row reading method. And transferring the loaded target Excel file to the entry parameter of the custom line-by-line reading method in the custom file reading abstract monitoring class, wherein the loaded target Excel file is taken as an actual parameter and is transferred to the form parameter of the custom line-by-line reading method in the custom file reading abstract monitoring class.
And S250, carrying out data reading processing on the file analysis result by calling a built-in data reading method of the easy Excel frame so as to realize the reading of the data in the target Excel file.
According to the technical scheme of the embodiment of the invention, the service processing class corresponding to the data reading request is determined, wherein the service processing class comprises a file import interface; and loading the target Excel file by calling the file import interface, so that the target Excel file is loaded by using the file import interface. And analyzing the loaded target Excel file by line by calling a custom line-by-line reading method in the custom file reading abstract monitoring class. According to the technical scheme of the embodiment of the invention, the file is loaded through the file import interface, and the file is analyzed through the user-defined line-by-line reading method, so that the coupling of the code can be reduced, and the reusability of the code is further improved.
EXAMPLE III
Fig. 3 is a schematic structural diagram of an easy excel-based file data reading apparatus according to a third embodiment of the present invention. As shown in fig. 3, the apparatus includes: a file determination module 310, a file parsing module 320, and a file reading module 330.
The file determining module 310 is configured to determine, after receiving a data reading request, a target Excel file corresponding to the data reading request; the file analysis module 320 is used for analyzing the target Excel file line by calling a custom file reading abstract monitoring class according to a custom line reading method to obtain a file analysis result, wherein the custom file reading abstract monitoring class inherits an event analysis monitoring class used for analyzing the analyzed Excel file in an easy Excel frame; and the file reading module 330 is configured to perform data reading processing on the file analysis result by calling a built-in data reading method of the easy Excel frame, so as to read data in the target Excel file.
According to the technical scheme of the embodiment of the invention, after the data reading request is received, the target Excel file corresponding to the data reading request is determined. A user-defined file reading abstract monitoring class is defined by inheriting an event analyzing monitoring class used for analyzing an analyzed Excel file in an easy Excel frame, and a user-defined line-by-line reading method is defined in the user-defined file reading abstract monitoring class. And then, a custom line-by-line reading method in the abstract monitoring class is read by calling the custom file, the target Excel file is analyzed and processed line-by-line, and the file can be flexibly read by using the bottom layer logic of the easy Excel frame. Thereby obtaining a file analysis result. And then, carrying out data reading processing on the file analysis result by calling a built-in data reading method of the easy Excel frame so as to realize the reading of the data in the target Excel file. According to the technical scheme of the embodiment of the invention, the data in the Excel file can be conveniently and flexibly read, the user requirements can be effectively responded, and the user requirements are improved. Optionally, the file parsing module 320 is specifically configured to:
determining a service processing class corresponding to the data reading request, wherein the service processing class comprises a file import interface;
loading the target Excel file by calling the file import interface;
and analyzing the loaded target Excel file by line by calling a custom line-by-line reading method in the custom file reading abstract monitoring class.
Optionally, the file parsing module 320 includes a file parsing processing unit; wherein, the file analysis processing unit is used for:
transferring the loaded target Excel file to an entry parameter of a custom line-by-line reading method in the custom file reading abstract monitoring class;
and after the parameter transmission is finished, calling a custom line-by-line reading method in the custom file reading abstract monitoring class, and analyzing and processing the target Excel file line-by-line.
Optionally, the file parsing module 320 includes a file loading unit; wherein the file loading unit is used for:
initializing a file import object of the file import interface by calling a construction method in the user-defined file reading abstract monitoring class;
and calling a file saving method of the file import interface based on the initial file import object, and loading and saving the target Excel file.
Optionally, the apparatus further comprises a data storage module; the data storage module is used for storing the read data into a preset data set by calling a data storage method in the user-defined file reading abstract monitoring class after data reading processing is carried out on the file analysis result; and storing the data in the preset data set to a preset database.
Optionally, the custom file reading abstract monitoring class includes a preset single data storage amount; the data storage module is specifically configured to:
and under the condition that the total amount of the data stored in a preset data set reaches the preset single data storage amount, storing the data stored in the preset data set into a preset database.
Optionally, the apparatus further includes a data clearing module, configured to clear data stored in the preset data set after storing the data stored in the preset data set in a preset database.
The easy excel-based file data reading device provided by the embodiment of the invention can execute the easy excel-based file data reading method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
It should be noted that, the units and modules included in the easy excel based file data reading apparatus are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the embodiment of the invention.
Example four
FIG. 4 shows a schematic block diagram of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 may also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to the bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
Processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, or the like. The processor 11 performs the respective methods and processes described above, such as the easy excel-based file data reading method.
In some embodiments, the easy excel based file data reading method can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the above-described easy excel-based file data reading method may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the easy excel-based file data reading method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on a machine, as a stand-alone software package partly on a machine and partly on a remote machine or entirely on a remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired result of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A file data reading method based on easy excel is characterized by comprising the following steps:
after a data reading request is received, determining a target Excel file corresponding to the data reading request;
analyzing the target Excel file line by calling a custom file reading abstract monitoring class according to a custom line reading method to obtain a file analysis result, wherein the custom file reading abstract monitoring class inherits an event analysis monitoring class which is used for analyzing the analyzed Excel file in an easy Excel frame;
and carrying out data reading processing on the file analysis result by calling a built-in data reading method of the easy Excel frame so as to realize the reading of the data in the target Excel file.
2. The method according to claim 1, wherein the analyzing the target Excel file by line by calling a custom read-by-line method in a custom file read abstract listening class comprises:
determining a service processing class corresponding to the data reading request, wherein the service processing class comprises a file import interface;
loading the target Excel file by calling the file import interface;
and analyzing the loaded target Excel file by line by calling a custom line-by-line reading method in the custom file reading abstract monitoring class.
3. The method according to claim 2, wherein the analyzing the loaded target Excel file by line by calling a custom read-by-line method in the custom file read abstract listening class comprises:
transferring the loaded target Excel file to an entry parameter of a custom line-by-line reading method in the custom file reading abstract monitoring class;
and after the parameter transmission is finished, calling a custom line-by-line reading method in the custom file reading abstract monitoring class, and analyzing and processing the target Excel file line-by-line.
4. The method according to claim 2, wherein the loading the target Excel file by calling the file import interface comprises:
initializing a file import object of the file import interface by calling a construction method in the user-defined file reading abstract monitoring class;
and calling a file saving method of the file import interface based on the initial file import object, and loading and saving the target Excel file.
5. The method according to claim 1, wherein after performing data reading processing on the file parsing result, the method further comprises:
reading a data storage method in the abstract monitoring class by calling the custom file, and storing the read data into a preset data set;
and storing the data in the preset data set to a preset database.
6. The method of claim 5, wherein the custom file read abstract listening class includes a preset single-time data storage amount, and the storing the data in the preset data set to a preset database includes:
and under the condition that the total amount of data stored in a preset data set reaches the preset single data storage amount, storing the data stored in the preset data set into a preset database.
7. The method of claim 6, wherein after storing the data stored in the preset data set to a preset database, the method further comprises:
and clearing the data stored in the preset data set.
8. An easy excel-based file data reading apparatus, comprising:
the file determining module is used for determining a target Excel file corresponding to a data reading request after the data reading request is received;
the file analysis module is used for analyzing the target Excel file line by calling a custom file reading abstract monitoring class according to a custom line reading method to obtain a file analysis result, wherein the custom file reading abstract monitoring class inherits an event analysis monitoring class used for analyzing the analyzed Excel file in an easy Excel frame;
and the file reading module is used for carrying out data reading processing on the file analysis result by calling a built-in data reading method of the easy Excel frame so as to realize the reading of the data in the target Excel file.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the easy excel based file data reading method of any of claims 1-7.
10. A computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions for causing a processor to implement the easy excel-based file data reading method according to any one of claims 1 to 7 when executed.
CN202310265044.6A 2023-03-20 2023-03-20 EasyExcel-based file data reading method, device, equipment and medium Pending CN115983222A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310265044.6A CN115983222A (en) 2023-03-20 2023-03-20 EasyExcel-based file data reading method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310265044.6A CN115983222A (en) 2023-03-20 2023-03-20 EasyExcel-based file data reading method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN115983222A true CN115983222A (en) 2023-04-18

Family

ID=85970863

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310265044.6A Pending CN115983222A (en) 2023-03-20 2023-03-20 EasyExcel-based file data reading method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN115983222A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111639473A (en) * 2020-04-24 2020-09-08 深圳壹账通智能科技有限公司 Excel file analysis method and device based on java, computer equipment and storage medium
CN112925749A (en) * 2021-02-20 2021-06-08 北京同邦卓益科技有限公司 Data processing method and device, electronic equipment and storage medium
CN114970474A (en) * 2022-05-12 2022-08-30 中国人民解放军陆军装甲兵学院 Excel import and export method and system based on data monitoring
CN115080651A (en) * 2022-07-12 2022-09-20 深圳壹账通智能科技有限公司 Excel data import method and device, electronic equipment and storage medium
CN115774745A (en) * 2021-09-07 2023-03-10 国家电网有限公司大数据中心 Extraction method and system for high-capacity Excel file data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111639473A (en) * 2020-04-24 2020-09-08 深圳壹账通智能科技有限公司 Excel file analysis method and device based on java, computer equipment and storage medium
CN112925749A (en) * 2021-02-20 2021-06-08 北京同邦卓益科技有限公司 Data processing method and device, electronic equipment and storage medium
CN115774745A (en) * 2021-09-07 2023-03-10 国家电网有限公司大数据中心 Extraction method and system for high-capacity Excel file data
CN114970474A (en) * 2022-05-12 2022-08-30 中国人民解放军陆军装甲兵学院 Excel import and export method and system based on data monitoring
CN115080651A (en) * 2022-07-12 2022-09-20 深圳壹账通智能科技有限公司 Excel data import method and device, electronic equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
IT技术分享网: "《easyexcel的简单应用》", pages 1 - 5, Retrieved from the Internet <URL:www.5ityx.com/cate100/134450.html> *
SHUNSHUNSHUN18: "《way_more的博客:Spring boot学习(二十五):Spring boot整合EasyExcel,操作Excel太简单了》", pages 1 - 4, Retrieved from the Internet <URL:blog.iis7.com/article/47783.html> *

Similar Documents

Publication Publication Date Title
CN114461644A (en) Data acquisition method and device, electronic equipment and storage medium
CN115048352B (en) Log field extraction method, device, equipment and storage medium
CN116545905A (en) Service health detection method and device, electronic equipment and storage medium
CN115454971A (en) Data migration method and device, electronic equipment and storage medium
CN116303013A (en) Source code analysis method, device, electronic equipment and storage medium
CN115905322A (en) Service processing method and device, electronic equipment and storage medium
CN115617800A (en) Data reading method and device, electronic equipment and storage medium
CN115269431A (en) Interface testing method and device, electronic equipment and storage medium
CN115563310A (en) Method, device, equipment and medium for determining key service node
CN115309730A (en) Data auditing method and device, electronic equipment and storage medium
CN115983222A (en) EasyExcel-based file data reading method, device, equipment and medium
CN112968876A (en) Content sharing method and device, electronic equipment and storage medium
CN116070601B (en) Data splicing method and device, electronic equipment and storage medium
CN115481090A (en) File processing method and device, electronic equipment and storage medium
CN115756575A (en) Submission record acquisition method, device, equipment and storage medium
CN117453747A (en) Data quality detection method and device, electronic equipment and storage medium
CN117520092A (en) Log data determining method and device, electronic equipment and medium
CN116308713A (en) Multiplexing method and device for business transaction codes, electronic equipment and storage medium
CN115794555A (en) Service log processing method, device, equipment and storage medium
CN115277765A (en) Cloud platform access method and device, electronic equipment and storage medium
CN115600029A (en) Method, device, system, equipment and storage medium for displaying webpage
CN117216066A (en) Material code generation method, device, equipment and storage medium
CN117609150A (en) Data migration method, device, equipment and medium
CN117032712A (en) Pipeline compiling and constructing method and device, electronic equipment and storage medium
CN115033823A (en) Method, apparatus, device, medium and product for processing data

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20230418