Method for supporting file import in Excel

By importing files in Excel, efficient processing and secure storage of multiple types of files are achieved, the problems of inconsistent processing processes and insufficient security in the existing technology are solved, and data processing efficiency and system robustness are improved .

CN119226370APending Publication Date: 2024-12-31SUZHOU REKTEC INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411246308.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

The lack of a unified automated processing process in the prior art, and it is impossible to achieve batch and efficient processing of various types of files, especially in scenarios where local and network files are processed, and the security of file data is also failed.

Method used

Provide a method that supports importing files in Excel, by parsing Excel files, extracting data and files, performing multi-level classification reading and downloading, and using intelligent error detection and correction mechanisms, combining HttpClient and System.IO.File classes for File download and storage, and data management is used to ensure file security and processing efficiency.

Benefits of technology

It realizes efficient processing of multiple types of files, improves the efficiency and accuracy of data processing, enhances the functionality and robustness of the system, meets data privacy and security needs, adapts to more usage scenarios, and provides exception handling mechanism to ensure data integrity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119226370A_ABST
    Figure CN119226370A_ABST
Patent Text Reader

Abstract

The invention discloses a method for supporting file import in Excel. The method comprises the steps that S1, a user makes an EXCEL file; s2, the manufactured EXCEL file is uploaded; s3, analyzing the uploaded EXCEL file, and extracting data and files in a column; s4, downloading or reading and checking according to the analyzed data and files; and S5, storing the analyzed data and files in a database. According to the invention, the file downloading module is combined with the multi-source file processing capability, the file downloading from the network URL and the local path is supported, the multi-source file processing capability of the system is enhanced, the file processing capability is expanded, the system is not limited to only support the network URL downloading, and compared with the prior art which only supports the network file downloading, the file downloading efficiency is greatly improved. And compared with insufficient local file processing capability, the system can adapt to more use scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electronic digital data processing, in particular to the technical field of a collection of database management systems or interface systems, and specifically to a method for supporting file import in Excel. Background Art

[0002] Excel is a common spreadsheet software, widely used in data management and analysis fields, such as statistical analysis, data visualization, automated calculations, document management, etc. Excel allows users to organize data in a tabular form, storing and managing information through rows and columns. Traditional EXCEL data processing methods mainly focus on the processing of text and numerical data, and the processing of multimedia files such as pictures, documents, audio and video is relatively limited. However, modern enterprises and organizations increasingly need to process various types of file data, including pictures, documents, presentations, etc., in the process of data processing. This demand has prompted the development of data processing technology towards diversification and efficiency.

[0003] In the prior art, the system allows users to upload Excel files containing file links, but users are required to click on the links one by one to download the files, lacking a unified automated processing flow. Most systems only support downloading files via URLs, and have weak processing capabilities for local file paths, limiting their application scope.

[0004] With the development of cloud computing and network technology, downloading files through HTTP / HTTPS protocol has become more common and efficient. However, the existing technology lacks solutions for scenarios that require processing local files and network files at the same time, and does not consider the processing of multiple types of files such as pictures, Word, PPT, etc. In addition, with the increasing requirements for data privacy and security, how to ensure the security of file data during downloading and storage has also become a problem that needs to be solved urgently.

[0005] Therefore, it is necessary to improve the method of importing files in Excel in the prior art to solve the above problems. Summary of the invention

[0006] The present invention overcomes the shortcomings of the prior art and provides a method for supporting file import in Excel, aiming to solve the problem in the prior art of lacking a unified and automated processing flow and being unable to realize batch and efficient processing of a large number of files including links such as pictures, documents, presentations, etc., as well as the problem when the system is applied in complex scenarios where local files and network files need to be processed simultaneously.

[0007] To achieve the above object, the technical solution adopted by the present invention is: a method for supporting importing files in Excel, comprising:

[0008] S1. The user creates an EXCEL file;

[0009] S2. Upload the prepared EXCEL file;

[0010] S3, parse the uploaded EXCEL file and extract the data and files in the column;

[0011] S4. Download or read and verify the parsed data and files;

[0012] S5. The parsed data and files are stored in a database;

[0013] In step S4,

[0014] S41, reading and downloading the EXCEL file by multi-level classification;

[0015] S42, verifying the downloaded EXCEL file;

[0016] S43, storing and managing the downloaded EXCEL file;

[0017] In step S41,

[0018] File reading, including:

[0019] a. Create a document list and fill in address information;

[0020] b. Integrate intelligent error detection and correction mechanisms during address resolution;

[0021] c. Identify address types and perform multi-level classification storage;

[0022] File download, including:

[0023] a. Cache the address;

[0024] b. The address is a network file, and the HttpClient class is used to download the network file;

[0025] c. The address is a local file, use the System.IO.File class to download the local file;

[0026] Multi-level classification storage includes:

[0027] (1) Extract the first characteristic point of the address and perform the first level classification; when the address starts with http: / / or https: / / , it is classified as a network address; when the address starts with file: / / / , it is classified as a local path using a uniform resource identifier URI;

[0028] (2) For addresses that cannot be distinguished by the first feature points, special feature points are extracted and a second level classification is performed; when the address begins with "." or " / ", it is classified as a network address, and the address is a local relative path; when the address is a complete path in the file system, it is classified as a network address, and the address is a local absolute path; when the address is neither a local relative path nor a local absolute path, the address is a network address;

[0029] (3) Perform error correction and repair on addresses that cannot pass through special feature points;

[0030] (4) Use File.Exist to determine whether the file exists on the local address;

[0031] (5) Determine different file formats by the extension of the file address and perform secondary classification;

[0032] a. Extract the second characteristic point in the file address, which is the part after the last dot "." in the file name;

[0033] b. Map the file extension to the corresponding MIME type;

[0034] c. Save the file name, extension association, and MIME type to the File object.

[0035] In a preferred embodiment of the present invention, in step S1,

[0036] S11. Create an Excel file, which should contain at least one worksheet;

[0037] S12. Set a header containing all required fields and file paths in the first row of the Excel file;

[0038] S13. Provide field filling instructions in the second row of the Excel file;

[0039] S14. After completing the filling, save the Excel file.

[0040] In a preferred embodiment of the present invention, in step S2:

[0041] S21. Select the Excel file to be uploaded through the file selection dialog control;

[0042] S22, after the file is uploaded successfully, the file content is temporarily stored in the memory;

[0043] S23. When an error occurs during the file upload process, the system prompts the user with error information and error description, and provides a solution.

[0044] In a preferred embodiment of the present invention, in step S3:

[0045] S31. Use NPOI library to read Excel file.

[0046] S32, identify column names and extract data;

[0047] S33, temporarily and structuredly storing the extracted data.

[0048] In a preferred embodiment of the present invention, in step S41, before downloading the file, it is checked whether the address already exists in the cache; if the address exists, the file content is directly obtained from the cache to avoid repeated downloading.

[0049] In a preferred embodiment of the present invention, in step S41, the step of performing error correction and repair includes: building a common error pattern library, which includes common spelling errors and format errors of users; matching the address that cannot be classified by the first feature point and the special feature point with the error pattern library; when the match is successful, correcting the address according to the correction rule; when the match is unsuccessful, providing a user interaction interface to allow the user to manually select or enter the correct address format.

[0050] In a preferred embodiment of the present invention, when the address cannot be determined or corrected in step S41, a fallback mechanism is provided to mark the address as "unresolvable".

[0051] In a preferred embodiment of the present invention, in step S23, errors include: client errors and server errors; client errors include: file not selected or not found, file size exceeds limit, file type is not accepted, network problem. Server errors include: insufficient storage space, server internal error, verification failure, file upload directory does not exist or cannot be written; each error is assigned a corresponding error code.

[0052] In a preferred embodiment of the present invention, in step S5,

[0053] S51, select and configure a database;

[0054] S52. Design the data table structure of the database;

[0055] S53. Use ORM framework for database operations to simplify data storage.

[0056] The present invention provides a device supporting Excel file import, the device comprises an electronic device, the electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor.

[0057] The present invention solves the defects existing in the background technology and has the following beneficial effects:

[0058] (1) The present invention provides a method for importing Excel files. Through an automated processing flow, the method allows users to upload Excel files containing file links, automatically download files in the links, and process local file paths, thereby improving the efficiency and accuracy of data processing. At the same time, the method also enhances data security and meets the growing data privacy and security needs.

[0059] (2) The present invention combines multi-type file multi-level classification storage and processing technology, extracts the first feature point of the address for the first level classification, realizes rapid diversion and reduces the content of the address pool; extracts special feature points for the remaining addresses for the second level classification, and finally corrects and falls back on the unclassifiable address resolution, so that the system can more reasonably allocate resources to process the remaining addresses, thereby improving the processing speed and efficiency; then extracts the extension name from the second feature point, maps the extension name to the corresponding MIME type, and realizes efficient processing of network and local pictures, Word, PPT and other files, so that Excel files can contain not only traditional data, but also various files, thereby increasing data integration and richness. Compared with the prior art, the functionality of the system is enhanced, the data representation and analysis methods are enriched, and the accuracy of file downloading and the robustness of the system are improved through intelligent error detection and correction, as well as identification and processing of different file types.

[0060] (3) The file of the present invention utilizes the combination of the file download module and the multi-source file processing capability, supports downloading files from network URLs and local paths, enhances the system's multi-source file processing capability, and expands the file processing capability. It is no longer limited to supporting only network URL downloads. Compared with the prior art that usually only supports network file downloads and has insufficient local file processing capabilities, the system can adapt to more usage scenarios, including offline environments.

[0061] (4) The exception handling mechanism of the present invention is combined with user feedback. The exception handling mechanism is added to each module and clear user feedback is provided. When problems occur, users can be notified in a timely manner and solutions can be provided to ensure data integrity and consistency, reduce data errors and loss risks, and enhance user controllability and trust in the system.

[0062] (5) The data storage module of the present invention is optimized with the database, and the database design and operation are optimized, thereby improving the efficiency and security of data storage, ensuring fast access and high security of data, and improving the reliability of data management and the long-term stability of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work.

[0064] Figure 1 is a flow chart of a preferred embodiment of the present invention;

[0065] Figure 2 It is a file upload module of a preferred embodiment of the present invention;

[0066] Figure 3 It is a data parsing module of a preferred embodiment of the present invention;

[0067] Figure 4 It is a data storage module of a preferred embodiment of the present invention;

[0068] Figure 5 It is a file download module of the preferred embodiment of the present invention. DETAILED DESCRIPTION

[0069] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0070] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.

[0071] In the description of this application, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood by specific circumstances.

[0072] A method for supporting importing a file in Excel, the steps comprising:

[0073] S1. The user creates an EXCEL file;

[0074] S2. Upload the prepared EXCEL file;

[0075] S3, parse the uploaded EXCEL file and extract the data and files in the column;

[0076] S4. Download or read and verify the parsed data and files;

[0077] S5. The parsed data and files are stored in the database.

[0078] Step S1 is the file creation module. As a prerequisite for the import function, the file creation module is responsible for describing the format requirements of the Excel file and ensuring that the Excel file generated by the user meets the system requirements. The file creation module is not part of the technical design of the import tool, but is used to guide users to manually create Excel files that meet the standards for subsequent import and processing.

[0079] Specifically, in step S1,

[0080] S11. Create an Excel file; the file format supports .xls and .xlsx. The Excel file should contain at least one worksheet. Furthermore, the sheet name is named "Data Input".

[0081] S12. Set a header containing all required fields and file paths in the first row of the Excel file;

[0082] Specifically, set the header in the first row of the Excel file. The column names should include all required fields and the file download address or local path field. Furthermore, set the column names to "Name", "Age", "File_Avatar", "File_Document", etc. Use clear and concise header names to facilitate user understanding and filling.

[0083] S13. Provide field filling instructions in the second row of the Excel file to explain the content and format requirements of each field;

[0084] Furthermore, the "Name" column description is "Please enter your name", and the "File_Document" column description is "Please enter the download address or local path of the document".

[0085] When creating an Excel file, the user needs to ensure that the data format is correct.

[0086] For example, the "Age" column should be entered as a number, and the "File_Picture" and "File_Document" columns should start with "http: / / " or "https: / / ", or be a local path.

[0087] The local path supports pasted file paths starting with file: / / / , and also supports direct local disk paths. The following two local paths are supported:

[0088] Path 1: file: / / / C: / Users / user / Desktop / 25589652145.png

[0089] Path 2: C: / Users / user / Desktop / 25589652145.png

[0090] Users can add sample data in Excel files to show the correct way to fill in data.

[0091] S14. After completing the filling, save the Excel file.

[0092] The file creation module ensures that users can manually create and fill out Excel files that meet system requirements, provides standardized data input, and provides a reliable basis for subsequent analysis and processing.

[0093] After saving the Excel file, upload the file through the file upload module of the program. The upload module will perform preliminary verification to ensure that the file meets the format requirements, and then pass it to the data parsing module for detailed parsing and processing.

[0094] like Figure 1 As shown, step S2 is performed in the file upload module. The main function of the file upload module is to allow users to upload Excel files containing file download addresses or local paths, and to perform preliminary verification of the file format and content to ensure that the file can be processed correctly. This module is the entry point of the system, responsible for receiving Excel files input by users, and passing the files to subsequent parsing modules for processing.

[0095] Specifically, in step S2, .xls and .xlsx file formats are supported, and the file extension and file content header information are checked to ensure that the uploaded file is a legal Excel file.

[0096] Specifically, in step S2:

[0097] S21. Select the Excel file to be uploaded through the file selection dialog control;

[0098] The file selection dialog control is: OpenFileDialog control; its function is to implement file selection; OpenFileDialog control allows users to select one or more files from their computers and returns the path of the file selected by the user.

[0099] In the file selection dialog box, limit the optional file types to Excel files to ensure that users can only select supported file formats; if the user selects a file, the full path of the file selected by the user can be obtained through the FileName property of the OpenFileDialog control.

[0100] Specifically, set the Filter property of OpenFileDialog to restrict users to only select Excel files. The Filter property is used to specify the file type filter displayed in the file dialog box.

[0101] openFileDialog.Filter="Excel Files(*.xls,*.xlsx)|*.xls;*.xlsx";

[0102] S22, after the file is uploaded successfully, the file content is temporarily stored in the memory;

[0103] The file path or file content is passed to the data parsing module for detailed parsing and processing to ensure the reliability and integrity of the file transfer process.

[0104] S23. When an error occurs during the file upload process, the system prompts the user with error information and error description, and provides a solution.

[0105] Monitor the file upload process and capture possible errors. Errors include: client errors and server errors; client errors include: file not selected or not found, file size exceeds the limit, file type is not accepted, network problems. Server errors include: insufficient storage space, internal server error, verification failure, file upload directory does not exist or cannot be written.

[0106] When errors occur, assign a unique error code to each error and provide a concise and clear description that is detailed enough for the user to understand the problem.

[0107] Client solution: For errors that can be verified by the front end, such as file size and type, provide clear guidance information to tell users how to modify them; for network problems, suggest users to check the network connection or try again later.

[0108] Server-side solution: For problems with insufficient storage space, users are advised to delete some unnecessary files or upgrade storage space. For internal server errors, users are advised to contact customer service or try again later. For problems with file content not conforming to the expected format, users are provided with guidance on modifying the file or re-uploading it.

[0109] Through the above design, the file upload module can effectively receive Excel files uploaded by users and provide necessary support and guarantee for subsequent data parsing and processing.

[0110] like Figure 2 As shown, step S3 is performed in the data parsing module, which is responsible for parsing the uploaded Excel file and extracting the data in the column, including the file download address or local path and other common field data. This module ensures accurate extraction of information from the Excel file and provides a basis for file download and data storage.

[0111] Specifically, in step S3:

[0112] S31. Use NPOI library to read Excel file;

[0113] The NPOI library loads the Excel file, creates an NPOI workbook object, then gets the first worksheet, traverses the first row of the table, and identifies all column names.

[0114] S32, identify column names and extract data;

[0115] By traversing the first row of cells in the table, identifying all column names and extracting the data in each column, preprocessing and converting the data in each column, such as removing spaces and converting data types, etc. This includes columns starting with "File_" and ordinary field columns.

[0116] S33, temporarily storing and structurally storing the extracted data;

[0117] Create a data structure list List <Dictionary<string,string> > records = new List <Dictionary<string,string> >(); used to store all records;

[0118] For each record, create a dictionary<string,string> record = newDictionary<string,string> (); to store common field data and file path or download address.

[0119] Save the relationship between column names and field values ​​in the form of key-value pairs in the record, and add each record to the records list for use by subsequent modules.

[0120] The data analysis module can accurately and efficiently analyze the uploaded Excel files, extract and pre-process the data, and provide a solid foundation for file download and data storage. The design of this module ensures the accuracy and efficiency of data processing, making the entire system process smoother and more reliable.

[0121] like Figure 4 As shown, step S4 is performed in the file download module, which is responsible for downloading or reading the file and verifying it according to the file address or path provided by the data parsing module to ensure that the file content is correct. This module supports multiple file types such as pictures, Word documents, PPT files, etc., and handles different download sources, including HTTP / HTTPS and local path file: / / / file path, relative path, and absolute path.

[0122] Specifically, in step S4,

[0123] S41, reading and downloading the EXCEL file by multi-level classification;

[0124] S411, file reading:

[0125] a. Create a file list and fill in the address information; define a file list set to record the relationship list of file address, file name, file extension, and file content <file>; Using the NPOI library, extract the cell contents as a string, parse all address lines with line breaks, and store the address lines in a file listing.

[0126] b. During the address resolution process, an intelligent error detection and correction mechanism is integrated; common address spelling errors or format errors, including extra spaces, missing slashes, etc., are identified and automatically corrected to ensure the accuracy of address resolution.

[0127] c. Identify address types and perform multi-level classification storage; traverse the List <file>, according to the format of the file address and the order of the file matching address rules, identify different file address types:

[0128] (1) Extract the first characteristic point of the address and perform the first level classification; when the address starts with http: / / or https: / / , it is classified as a network address; when the address starts with file: / / / , it is classified as a local path using a uniform resource identifier URI;

[0129] The resolved address is first classified at the first level to reduce the address pool capacity, and the network address and the local path using URI can be quickly separated from the address pool. The rapid diversion reduces the amount of data that needs to be processed in subsequent processing, improves the overall processing efficiency, and provides a clear classification basis for subsequent processing. The first level classification has removed most of the address data, and the amount of data processed in the second level classification is greatly reduced, which reduces the burden on the subsequent processing module and improves the processing speed and efficiency.

[0130] (2) For addresses that cannot be distinguished by the first feature points, special feature points are extracted and a second level of classification is performed;

[0131] When the address starts with "." or " / ", it is classified as a network address and the address is a local relative path; when the address is a complete path in the file system, it is classified as a network address and the address is a local absolute path; when the address is neither a local relative path nor a local absolute path, the address is a network address;

[0132] The second level classification is mainly aimed at the remaining addresses that are not clearly distinguished in the first classification. Since most of the easily identifiable address types have been removed, the system can allocate resources more reasonably to handle more special or complex address situations. This makes the classification logic more concise and clear, reducing the possibility of errors.

[0133] (3) Perform error correction and repair on addresses that cannot pass through special feature points;

[0134] Build a common error pattern library, including common spelling errors and format errors of users; match the addresses that cannot be classified by the first feature point and special feature point with the error pattern library; if the match is successful, correct the address according to the correction rules; if the match is unsuccessful, provide a user interaction interface to let the user manually select or enter the correct address format;

[0135] (4) Use File.Exist to determine whether the file exists on the local address;

[0136] (5) Determine different file formats by the extension of the file address and perform secondary classification;

[0137] a. Extract the second feature point in the file address, the part after the last dot ".." in the file name; specifically, ".jpg", "docx".

[0138] b. Map the extension to the corresponding file MIME type; MIME type is a standard used to define the type and format of a file so that browsers or other applications can correctly handle different types of files, such as "image / png", "application / msword",

[0139] "application / vnd.ms-powerpoint".

[0140] c. Save the file name, extension association, and their mapped MIME type into the File object to provide a basis for subsequent verification.

[0141] When all the above methods fail to correct the address, a fallback mechanism is provided to mark the address as "unresolvable" and give it special treatment in subsequent processing or prompt the user to handle it manually.

[0142] S412, File Download:

[0143] a. Cache the address; specifically, before downloading the file, check whether there is an entry for the URL in the cache dictionary. If it exists, get the file content directly from the cache to avoid repeated downloads; use a ConcurrentDictionary<string,byte[]> To store the mapping between the URL of the downloaded file and the file content. ConcurrentDictionary is thread-safe and suitable for use in a multi-threaded environment. When the file is downloaded for the first time or the file in the cache has expired, the new file is downloaded and the cache is updated.

[0144] b. The address is a network file, and the HttpClient class is used to download the network file; multi-threaded parallel technology is used to achieve parallel download of multiple files, making full use of the local network bandwidth to improve download efficiency. After downloading, the hash value of the file content, specifically including MD5 and SHA256, is used for verification to ensure the integrity and correctness of the file content.

[0145] c. The address is a local file. Use the System.IO.File class to download the local file. It supports file: / / / file path, relative path and absolute path. The read file also performs content verification to ensure that the file meets expectations.

[0146] S42, verifying the downloaded EXCEL file;

[0147] Verify the downloaded or read files, including file size, MIME type, etc., to ensure that the files meet expectations and prevent data corruption or inconsistency.

[0148] S43. Store and manage the downloaded EXCEL file.

[0149] The downloaded or read files are stored in binary form in memory and organized and managed in the form of FileRecord objects. Provides a data interface for the data storage module, associates files with records, and ensures effective management and use of file data.

[0150] The file download module obtains files through network download and local reading, and combines HttpClient and System.IO.File classes to achieve efficient file processing. After the file is downloaded or read, a series of verification steps are performed to ensure that the file content is correct. The downloaded or read file data is stored in the memory and managed in the form of FileRecord objects, ready to be passed to the data storage module to effectively associate the file with the record. The design of this module ensures the efficiency and reliability of the file download, reading, verification and storage process, and provides reliable file data support for the data storage module, thereby improving the stability of the system and the integrity of the data.

[0151] Step S5 is performed in the data storage module; Figure 3 As shown, the data storage module is responsible for storing the parsed data and files in the database. This module ensures that data and files are correctly stored and associated, and provides efficient data management and retrieval capabilities. It supports multiple database types and simplifies database operations through ORM (such as Entity Framework).

[0152] S51, select and configure a database;

[0153] Select a suitable database system according to system requirements, support relational databases such as SQL Server and MySQL, and manage database connection strings in the configuration file to facilitate database switching and configuration management.

[0154] S52. Design the data table structure of the database;

[0155] The data table structure includes common field data table and file data table. Common field data table stores parsed common data, and file data table stores file metadata and binary data. The two are linked by foreign key relationships to ensure that each record and its related files can be correctly linked and managed.

[0156] Example of common field data table structure:

[0157] Record table: contains ID and multiple fields (such as Field1, Field2, etc.).

[0158] Example of file data table structure:

[0159] FileRecord table: contains ID, file name, file data, and associated Record ID.

[0160] S53. Use the ORM framework for database operations to simplify data storage; associate common field data with file data through foreign key relationships to ensure data consistency.

[0161] Data storage includes saving parsed common field data and file data. When common field data is saved, a record ID is generated, and when file data is saved, the file is associated with the corresponding record through a foreign key.

[0162] Data storage process:

[0163] Save common field data;

[0164] Generate record ID;

[0165] Associate the file data with the record ID and save it;

[0166] Transaction management is used to ensure the atomicity of data operations and prevent data loss or damage. When an operation fails, the transaction is rolled back to ensure that the database state is consistent.

[0167] The database provides an efficient data retrieval interface, supports queries based on common fields and file metadata, ensures data consistency and integrity, and protects data security through transaction operations.

[0168] The data storage module can efficiently and reliably store the parsed data and its associated files, and provide efficient data retrieval and management functions, thus ensuring the stability of the entire system and the efficiency of data management.

[0169] The present invention provides an improved Excel file import method, which parses the Excel file containing the file download address or local path, and downloads the relevant file into the database as the attached attribute of the record. It supports multiple file types such as pictures, Word, PPT, etc., not limited to picture files, increases the practicality and data integration of the system, supports HTTP / HTTPS download and local path (file: / / / file path, relative path, absolute path) file processing, and enhances the flexibility of the file download module.

[0170] The above is based on the ideal embodiment of the present invention. Through the above description, relevant personnel can make various changes and modifications without departing from the technical concept of the present invention. The technical scope of the present invention is not limited to the content in the specification, and the technical scope must be determined according to the scope of the claims.< / file> < / file>

Claims

1. A method for supporting importing files in Excel, characterized in that the steps include: S1. The user creates an EXCEL file; S2. Upload the prepared EXCEL file; S3, parse the uploaded EXCEL file and extract the data and files in the column; S4. Download or read and verify the parsed data and files; S5. The parsed data and files are stored in a database; In step S4, S41, reading and downloading the EXCEL file by multi-level classification; S42, verifying the downloaded EXCEL file; S43, storing and managing the downloaded EXCEL file; In step S41, File reading, including: a. Create a document list and fill in address information; b. Integrate intelligent error detection and correction mechanisms during address resolution; c. Identify address types and perform multi-level classification storage; File download, including: a. Cache the address; b. The address is a network file, and the HttpClient class is used to download the network file; c. The address is a local file, use the System.IO.File class to download the local file; Multi-level classification storage includes: (1) Extract the first feature point of the address and perform the first level classification; (2) For addresses that cannot be distinguished by the first feature points, special feature points are extracted and a second level of classification is performed; (3) Perform error correction and repair on addresses that cannot pass through special feature points; (4) Use File.Exist to determine whether the file exists on the local address; (5) Different file formats are determined by the extension of the file address and secondary classification is performed.

2. A method for supporting importing files in Excel according to claim 1, characterized in that: In step S1, S11. Create an Excel file, which should contain at least one worksheet; S12. Set a header containing all required fields and file paths in the first row of the Excel file; S13. Provide field filling instructions in the second row of the Excel file; S14. After completing the filling, save the Excel file.

3. A method for supporting importing files in Excel according to claim 1, characterized in that: In step S2: S21. Select the Excel file to be uploaded through the file selection dialog control; S22, after the file is uploaded successfully, the file content is temporarily stored in the memory; S23. When an error occurs during the file upload process, the system prompts the user with error information and error description, and provides a solution.

4. A method for supporting importing files in Excel according to claim 1, characterized in that: In step S3: S31. Use NPOI library to read Excel file; S32, identify column names and extract data; S33, temporarily and structuredly storing the extracted data.

5. A method for supporting importing files in Excel according to claim 1, characterized in that: In step S41, before downloading the file, check whether the address already exists in the cache; if the address exists, the file content is directly obtained from the cache to avoid repeated downloading.

6. A method for supporting importing files in Excel according to claim 1, characterized in that: In step S41, the steps of error correction and repair include: building a common error pattern library, which includes common spelling errors and format errors of users; matching the addresses that cannot be classified by the first feature point and the special feature point with the error pattern library; when the match is successful, correcting the address according to the correction rules; when the match is unsuccessful, providing a user interaction interface to allow the user to manually select or enter the correct address format.

7. A method for supporting importing files in Excel according to claim 1, characterized in that: When the address cannot be determined or corrected in step S41, a fallback mechanism is set to mark the address as "unresolvable".

8. A method for supporting importing files in Excel according to claim 3, characterized in that: In S23, errors include: client error and server error; client errors include: file not selected or not found, file size exceeds limit, file type is not accepted, network problem; server errors include: insufficient storage space, internal server error, verification failure, file upload directory does not exist or cannot be written; each error is assigned a corresponding error code.

9. A method for supporting importing files in Excel according to claim 1, characterized in that: In step S5, S51, select and configure a database; S52. Design the data table structure of the database; S53. Use ORM framework for database operations to simplify data storage.

10. A device supporting importing files in Excel, comprising an electronic device, wherein the electronic device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method for supporting file import in Excel as described in any one of claims 1 to 9 is implemented.