Data analysis method and related product

By converting and registering data tables in a spreadsheet program to the target database for SQL query, the problem of cross-system operation is solved, and efficient data analysis and user-friendly experience are achieved.

CN120804195APending Publication Date: 2025-10-17TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510933725.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-04
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

In the prior art, spreadsheet programs are independent of systems with SQL query capabilities, which results in the need for cross-system operations during the data analysis process, affecting efficiency and user experience.

Method used

Obtain data tables from a spreadsheet program and convert them into a format supported by the target database. Register the data in the target database for SQL queries, output the results in the spreadsheet program, and use the target database for data analysis.

Benefits of technology

It enables data query and result display directly in the spreadsheet program without cross-system operations, improving data analysis efficiency and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120804195A_ABST
    Figure CN120804195A_ABST
Patent Text Reader

Abstract

The invention discloses a data analysis method and a related product. The method comprises the following steps: acquiring a first data table from a spreadsheet program; converting the first data table according to a target format to obtain a second data table, the target format being a file format supported by a target database, and the target database having an SQL query function; registering the second data table to a target database; in the spreadsheet program, SQL query operation is executed on the second data table through the target database, and a query result is obtained; and outputting a query result through a spreadsheet program. Therefore, a user can directly perform data query and result display on the second data table by means of the target database in the environment of the spreadsheet program without cross-system manual operation, so that professional data analysis capability can be provided for the spreadsheet program, the convenience degree of SQL query operation can be effectively improved, and the user experience is improved. Therefore, the data analysis efficiency and the user experience are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, and in particular, to a data analysis method and related products. BACKGROUND

[0002] An electronic spreadsheet program is a computer program that simulates a paper-based computing table, displays a grid composed of a series of rows and columns, i.e., a cell, and stores numerical values, calculation formulas, or text in the cell to form a corresponding data table. Further, since a structured query language (SQL) can easily perform complex data query operations based on functions, the data table in the electronic spreadsheet program can be analyzed professionally with the help of the SQL.

[0003] Therefore, in actual applications, a user can first export a data table from an electronic spreadsheet program, and then upload the data table to a system with a SQL running function, so as to perform data analysis through the system. However, since the system and the electronic spreadsheet program are independent of each other, after the system performs a SQL query operation, the user still needs to manually open the electronic spreadsheet program, and perform data viewing or chart generation operations in the electronic spreadsheet program to output and display the query result. It can be seen that the entire process is cross-system operation and requires manual switching of the user, which leads to inconvenient operation and affects data analysis efficiency and user experience. SUMMARY

[0004] The embodiments of the present application provide a data analysis method and related products to improve the convenience of a SQL query operation, thereby improving data analysis efficiency and user experience.

[0005] The embodiments of the present application disclose the following technical solutions:

[0006] In a first aspect, the embodiments of the present application provide a data analysis method, comprising:

[0007] obtaining a first data table from an electronic spreadsheet program;

[0008] performing conversion processing on the first data table according to a target format to obtain a second data table, the target format being a file format supported by a target database, and the target database having a structured query language (SQL) query function;

[0009] registering the second data table to the target database;

[0010] performing a SQL query operation on the second data table through the target database in the electronic spreadsheet program to obtain a query result;

[0011] outputting the query result through the electronic spreadsheet program.

[0012] In a second aspect, the embodiments of the present application provide a data analysis apparatus, comprising:

[0013] a data table obtaining module, configured to obtain a first data table from a spreadsheet program;

[0014] a format conversion module, configured to convert the first data table according to a target format to obtain a second data table, wherein the target format is a file format supported by a target database, and the target database has a structured query language (SQL) query function;

[0015] a data table registration module, configured to register the second data table to the target database;

[0016] a SQL query module, configured to perform a SQL query operation on the second data table through the target database in the spreadsheet program to obtain a query result;

[0017] a data output module, configured to output the query result through the spreadsheet program.

[0018] In a third aspect, the embodiments of the present application provide an electronic device, comprising a processor and a memory:

[0019] the memory is configured to store a computer program and transmit the computer program to the processor;

[0020] the processor is configured to execute the steps of the data analysis method provided in the first aspect according to instructions in the computer program.

[0021] In a fourth aspect, the embodiments of the present application provide a computer readable storage medium, configured to store program codes, wherein the program codes are configured to execute the steps of the data analysis method provided in the first aspect.

[0022] In a fifth aspect, the embodiments of the present application provide a computer program product, comprising a computer program or instructions, which, when executed by a processor, implement the steps of the data analysis method provided in the first aspect.

[0023] From the above technical solutions, it can be seen that the embodiments of the present application have the following advantages:

[0024] In the embodiments of the present application, after obtaining the first data table from the spreadsheet program, the first data table can be converted into a second data table according to the target format. Since the target format is a file format supported by the target database, the second data table can be successfully registered in the target database. Since the target database has a SQL query function, the second data table can be conveniently queried in the spreadsheet program with the help of the target database, and the query result can be obtained. Finally, the query result can be output through the spreadsheet program. In this way, the user can directly query the second data table in the environment of the spreadsheet program with the help of the target database, and display the result without manual operation across systems. Therefore, the professional data analysis capability can be provided for the spreadsheet program, and the convenience of the SQL query operation can be effectively improved, thereby improving the data analysis efficiency and user experience. BRIEF DESCRIPTION OF DRAWINGS

[0025] Figure 1 A flowchart of a data analysis method provided by the embodiments of the present application;

[0026] Figure 2 A structural schematic diagram of a mechanism for performing a data analysis method offline provided by the embodiments of the present application;

[0027] FIG. 3 is a schematic diagram of an application scenario of a data analysis method provided by the embodiments of the present application;

[0028] Figure 4 A structural schematic diagram of a data analysis device provided by the embodiments of the present application;

[0029] Figure 5 A structural schematic diagram of a server provided by the embodiments of the present application;

[0030] Figure 6 A structural schematic diagram of a terminal device provided by the embodiments of the present application. DETAILED DESCRIPTION

[0031] To facilitate understanding, the following first introduces the terms that may be involved in the embodiments of the present application.

[0032] DuckDB is an open-source embedded analytical database management system. It uses columnar storage and vectorized execution engine, supports standard SQL syntax, can be embedded in application programs without independent server, and is suitable for local data analysis and embedded data application scenarios.

[0033] WebAssembly (wasm), a virtual instruction set architecture, as a binary encoding format, its overall architecture includes the core ISA definition, binary encoding, definition and execution of program semantics, and application programming interfaces for different embedded environments. Its initial goal is to compile programs written in languages such as C / C++ to run better on the Web platform while ensuring security and running at near-native application speed.

[0034] WebView refers to a web view. It can be embedded in mobile terminals to achieve hybrid development of the front end, and most hybrid development frameworks are based on the WebView mode for secondary development

[0035] CSV (Comma-Separated Values, comma-separated values) is a common and relatively simple file format. Its file stores table data in plain text form.

[0036] Excel add-ins are plug-ins that provide extended functionality for Excel, including Excel macro loading, COM add-in, and Office add-in. They can be enabled through file options, development tools tab, or direct browsing installation.

[0037] JavaScript is a lightweight, interpreted, or just-in-time compiled programming language widely used in web development, mainly for enhancing the interactivity and dynamic nature of web pages.

[0038] Further, as described above, the spreadsheet program takes Excel as an example, and the system with SQL running function takes the official SQL website as an example. Users can first export the data table to be analyzed from Excel, and then upload the data table to the official SQL website to perform data analysis through the SQL editing capabilities provided by the website.

[0039] However, for the scheme of uploading data tables to such a system for analysis, since the SQL running function cannot be directly deployed to the corresponding spreadsheet program, users need to manually upload the data table to the corresponding system after exporting it. After executing the SQL query, the query results also need to be viewed in the spreadsheet program or generate charts and other operations by the user.

[0040] As can be seen, the entire process involves cross-system operations and requires manual user switching, losing the convenience of one-stop operation. Therefore, it is very inconvenient to operate in practice, affecting data analysis efficiency and user experience.

[0041] Based on the above problems, the embodiment of the present application provides a data analysis method. After obtaining the first data table from the spreadsheet program, the first data table can be converted into a second data table according to a target format. Since the target format is a file format supported by the target database, the second data table can be successfully registered in the target database. Since the target database has a SQL query function, the second data table can be conveniently queried in the spreadsheet program with the help of the target database, and the query result can be obtained. Finally, the query result can be output through the spreadsheet program.

[0042] In this way, the user can directly query the second data table in the environment of the spreadsheet program with the help of the target database, and display the result without manual operation across systems. Therefore, the spreadsheet program can provide professional data analysis capabilities, and the convenience of SQL query operation can be effectively improved, thereby improving data analysis efficiency and user experience.

[0043] It can be understood that in the embodiment of the present application, since the first data table and other data related to the user information are involved, when the above embodiments of the present application are applied to specific products or technologies, the user's permission or consent is required, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0044] It should be noted that the embodiment of the present application does not limit the subject performing the technical solution of the present application. For example, the data analysis method provided by the embodiment of the present application can be applied to a user terminal or a server, or processed by the user terminal and the server cooperatively. As an example, the user terminal includes but is not limited to a mobile phone, a computer, a smart voice interaction device, a smart home appliance, a vehicle-mounted terminal, an aircraft, etc. The server can be a standalone server, a cluster server or a cloud server.

[0045] In order for those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0046] Figure 1 A flowchart of a data analysis method provided by the embodiment of the present application is shown in FIG. 1. In conjunction with FIG. 1, the data analysis method provided by the embodiment of the present application can include the following steps S101-S105: Figure 1

[0047] S101: Obtain a first data table from a spreadsheet program.​

[0048] The first data table can be a data table to be analyzed. In actual application, taking Excel as an example, the first data table can be a worksheet in an Excel workbook, and the file format can be xlsx.

[0049] Correspondingly, for the acquisition process of the first data table, in specific implementation, the data table to be analyzed in the spreadsheet program can be read through the interface for interacting with the spreadsheet program, and the data table to be analyzed and the corresponding table content are read in the form of a two-dimensional array, that is, the first data table can be obtained.

[0050] For ease of understanding, taking Excel as an example, the interface for interacting with the spreadsheet program can be Excel Javascript API. Excel JavaScript API allows objects such as Excel workbook, worksheet, cell range, table or chart to be operated through JavaScript code.

[0051] S102: converting and processing the first data table according to a target format to obtain a second data table, the target format being a file format supported by a target database, and the target database having a SQL query function.

[0052] Considering that the file format of the first data table can only be applicable to the spreadsheet program itself, in order to enable the target database to easily analyze the first data table subsequently, in the embodiments of the present application, the first data table can be first converted in format according to the file format supported by the target database, so that the obtained data table (i.e., the second data table) can be successfully registered to the target database, thereby facilitating data analysis by means of the target database.

[0053] Based on this, for ease of understanding, the conversion process can be exemplarily described in combination with a possible implementation.

[0054] As an example, the target database can be DuckDB, and the corresponding target format can be CSV. Correspondingly, as mentioned above, the data table includes a series of cells, and the cells can store corresponding data content. Therefore, the first data table can include a plurality of cells, and the plurality of cells include a target cell. The target cell includes at least one target character of English double quotation marks (denoted as "), line feed (represented as carriage return line feed \r\n or only line feed \n) and English comma (denoted as,).

[0055] Based on this, for the acquisition process of the second data table, in specific implementation, the content corresponding to the target character can be first surrounded by the preset character corresponding to the target format.

[0056] Here, since the target format is CSV, the preset character can be an English double quotation mark. Accordingly, when the target character includes a double quotation mark, the corresponding content thereof can be the content in the double quotation mark, for example, “"sample"” can be processed as “""sample""”; when the target character includes a line break or an English comma, the corresponding content thereof can include the complete context, for example, “Hello, friends” can be processed as “"Hello, friends"”.

[0057] Further, if the target character in the target cell includes an English double quotation mark, the English double quotation mark can be subjected to an escape processing, thereby obtaining the second data table.

[0058] For example, since the target format is CSV, the English double quotation mark can be escaped using a backslash (denoted as \), for example, “O"Reilly” is escaped as “O\"Reilly”.

[0059] In this way, since CSV is a very common file format, which is independent of specific operating systems or software and can be read and processed on a large number of platforms (including DuckDB), setting the target format as CSV can enable DuckDB to easily perform data analysis and improve the applicability of the second data table. At the same time, through the above escape processing process, it is also helpful to improve the accuracy and integrity of the data table.

[0060] Further, in practical applications, considering that the data table in the spreadsheet program can also include one or more tables, each table can have its own name and content, therefore, when the first data table is subjected to the conversion processing, different processing methods can be adopted for the one or more tables. For ease of understanding, the following still takes CSV as the target format to exemplarily illustrate the processing process.

[0061] As an example, if the first data table includes only one table, the name of the first data table can be directly used as the CSV file name (i.e., the name of the second data table), and the content of the first data table can be subjected to the conversion processing according to the target format, thereby obtaining the corresponding CSV file content (i.e., the content of the second data table).

[0062] As another example, if the first data table includes multiple tables, the names of the multiple tables can be respectively used as the names of the multiple second data tables, and the contents of the multiple tables can be respectively subjected to the conversion processing according to the target format, thereby obtaining the multiple second data tables. The process of subjecting the contents of the multiple tables to the conversion processing according to the target format can be referred to the introduction made above, and will not be repeated here.

[0063] In this way, no matter how many tables in the first data table, the present solution can convert each table into a corresponding second data table, thereby facilitating subsequent execution of the SQL query operation using the target database to improve the query range and accuracy.

[0064] S103: Register the second data table to the target database.

[0065] After obtaining the second data table in the target format, it can be registered in the target database. In this way, the data conversion from the spreadsheet program to the target database is completed. In this way, subsequent SQL query operations and result display on the second data table in the spreadsheet program can be directly performed by means of the target database.

[0066] In practical applications, different target databases can have different registration processes. Based on this, the embodiments of the present application can not limit the process of registering the second data table, and can use any registration method corresponding to the existing or future target database.

[0067] S104: In the spreadsheet program, execute the SQL query operation on the second data table through the target database to obtain the query result.

[0068] In the embodiments of the present application, when the user inputs the SQL query statement, the SQL query can be performed based on the SQL query statement to obtain the query result.

[0069] However, in practical applications, the SQL query statement can include multiple SQL sub-statements, and some databases such as DuckDB do not support the case of executing an SQL query operation once and returning the query results corresponding to multiple SQL sub-statements. Based on this, in the case where the SQL query statement includes multiple SQL sub-statements, the execution process of the SQL query operation can be exemplarily described in the embodiments of the present application.

[0070] As an example, first, the SQL query statement including multiple SQL sub-statements can be received.

[0071] Next, the multiple SQL sub-statements are parsed by the SQL parser to obtain the structure information of each SQL sub-statement in the multiple SQL sub-statements. Here, the structure information of each SQL sub-statement can be embodied as the number of parameters of each SQL sub-statement and the starting position in the SQL query statement.

[0072] Then, when the query parameters corresponding to the SQL query operation are received, the corresponding sub-statements and parameters can be intercepted in the spreadsheet program based on the parameter quantity, the corresponding starting position, and the query parameters of each SQL sub-statement to perform the SQL query operation, until all SQL sub-statements are queried, and the query results corresponding to each SQL sub-statement are obtained.

[0073] In this way, by the above setting, the application range of the SQL query can be expanded, and even if the target database does not support performing a SQL query and returning multiple query results, the corresponding query results can also be quickly and accurately obtained.

[0074] S105: Output the query results through the spreadsheet program.

[0075] As mentioned above, the data table in the spreadsheet program can be read through the interface for interacting with the spreadsheet program. Accordingly, when the data is displayed, the query results obtained by querying the target data can also be written into the spreadsheet program through the interface, so that the user can directly realize the display of the query results in the environment of the spreadsheet program without manual operation across systems. Therefore, the professional data analysis capability can be provided for the spreadsheet program, and the convenience of the SQL query operation can be effectively improved, thereby improving the data analysis efficiency and the user experience.

[0076] For ease of understanding, the spreadsheet program is still taken as Excel, and the interface for interacting with the spreadsheet program can still be implemented by using Excel Javascript API. That is, the query results are written into Excel through Excel Javascript API. In addition, if the data quantity of the query results is too large, the batch writing mode can also be used to optimize the performance.

[0077] Based on the above steps S101-S105, it can be known that in the embodiment of the present application, after the first data table is obtained from the spreadsheet program, the first data table can be converted into a second data table according to the target format. Since the target format is the file format supported by the target database, the second data table can be successfully registered to the target database. Since the target database has the SQL query function, the second data table can be conveniently queried in the spreadsheet program by means of the target database to obtain the query results, and finally the query results are output through the spreadsheet program. In this way, the user can directly query the second data table in the environment of the spreadsheet program by means of the target database, and display the results without manual operation across systems. Therefore, the professional data analysis capability can be provided for the spreadsheet program, and the convenience of the SQL query operation can be effectively improved, thereby improving the data analysis efficiency and the user experience.

[0078] Further, in actual application, the user uploads the data table to the system with SQL running function, and the query performance is affected by network time consumption and data transmission consumption due to the interaction between the client and the server of the system, and the data security risk is increased by uploading to the server through the network.

[0079] Based on the above problems, the scheme can further introduce an offline execution mechanism, that is, the client supports the data query process in an offline manner, and the subsequent processing process does not need to rely on the server environment after the relevant resources are loaded for the first time, thereby helping to improve the data query performance, reduce the dependence on the server resources, and reduce the data security risk.

[0080] Based on this, in the embodiment of the present application, in combination with Figure 2 As shown in the figure, the spreadsheet program takes Excel as an example, and the target database can execute the database query operation through WebAssembly running in the webpage. The target database takes DuckDB as an example, and uses the database management system in the WebAssembly of DuckDB as a SQL execution engine, so that the engine can run smoothly in the webpage view (WebView) environment, that is, in the above-mentioned webpage.

[0081] Further, based on the above framework, before obtaining the first data table from the spreadsheet program, that is, before executing the above step S101, the relevant resources can be obtained to run the SQL query operation. For the convenience of understanding, an example is introduced below.

[0082] As an example, first, the service thread Service Worker in the webpage can be started, and the Service Worker can communicate with the server. Since the Service Worker is a thread independent of the main thread, it runs in the background of the webpage, and even if the main thread is in a busy state, the Service Worker can still perform tasks. Therefore, this independence enables the Service Worker to handle various tasks in the background without affecting the main thread's response to the user interface.

[0083] Then, in response to the first resource loading request, the database resources corresponding to the first resource loading request can be obtained from the server through the Service Worker, and the first resource loading request is the resource loading request sent when the webpage is opened for the first time.

[0084] In combination with Figure 2As shown, as an example, when a user loads resources for the first time through the client corresponding to WebView, the Service Worker service will initiate a request to the server to obtain the corresponding database resources.

[0085] The database resources can then be stored locally on the web page. These resources include web page runtime resources and user usage data in the target database. Web page runtime resources include the WebAssembly runtime code and the runtime resources required for the web page. Usage data includes the user's SQL scripts in different workspaces in the target database, as well as the user's historical access information and configuration information for the target database.

[0086] Accordingly, combined Figure 2 As shown, in a specific implementation, the web page running resources can be stored in the local cache mechanism CacheStorage of the web page, the SQL scripts can be stored in the local database IndexedDB of the web page, and the key-value pair storage mechanism LocalStorage of the web page can be stored.

[0087] For example, combining Figure 2 As shown, the runtime resources required for the web page are, for example, necessary Javascript scripts and image resources in various formats (such as SVG, JPG or PNG). These runtime resources and the WebAssembly runtime code will be stored in Figure 2 Cache storage. Furthermore, because SQL scripts in various workspaces of the target database are large in size, they are stored in IndexedDB, enabling long-term storage of large amounts of data. However, historical user access information and configuration information for the target database is smaller in size and can be stored in LocalStorage, allowing for smaller amounts of data to be stored there.

[0088] In this way, when the user subsequently opens the above web page again and sends a resource loading request, that is, a second resource loading request, since the second resource loading request is not the resource loading request sent when the web page is opened for the first time, the second resource loading request can be responded to, and the second resource loading request can be intercepted and processed by the Service Worker, and the second resource loading request can be redirected to the above database resource, so that the resource corresponding to the second resource loading request can be obtained from the locally stored database resource.

[0089] Combine Figure 2As shown, since the running resources of the webpage have been cached into the local Cache storage at the first loading, the usage data of the target database of the user has also been stored in the local database IndexDB and LocalStorage. Therefore, the database resources can be quickly obtained from the local for data analysis, which makes the entire application have complete offline access capability, and can operate based on the locally cached and stored data even without network connection, for example, in the spreadsheet program, performing SQL query operation on the second data table through the target database.

[0090] It can be seen that by caching the running code of WebAssembly and the necessary running resources of the webpage into the Cache storage, the resources can be avoided to be downloaded from the server every time, thereby greatly shortening the loading time, improving the starting speed of the application, and enabling the user to start using the functions related to the target database more quickly. Moreover, storing the SQL script into IndexedDB and saving the usage data into LocalStorage enables different types of storage operations to be performed in parallel without interference, thereby improving the overall data access efficiency. IndexedDB is suitable for storing SQL scripts with large data volume, while LocalStorage is used for usage data and other data with small data volume, thereby helping to avoid waste of storage space and improving the storage efficiency.

[0091] Further, based on the data analysis method provided in the foregoing embodiments, in order to facilitate understanding, the present embodiments can also provide an actual application scenario of the data analysis method, which will be described below in combination with embodiments and drawings.

[0092] As an example, in combination with (a) shown in FIG. 3, the spreadsheet program takes Excel as an example. After opening Excel, the user can first install the Excel add-in. In specific implementation, to implement the data analysis method of the foregoing embodiments, the data analysis method described in the foregoing embodiments can be encapsulated into the Excel add-in to obtain the SQL Analysis add-in, so that the SQL Analysis add-in is installed first after opening Excel.

[0093] Then, in combination with (b) shown in FIG. 3, the user can click to enter the add-in and input the SQL query statement therein to perform SQL query.

[0094] Finally, in combination with (c) shown in FIG. 3, the query result will be displayed in the form of a new data table.

[0095] Therefore, the user can directly perform SQL query and result display in Excel without manual operation across systems, professional data analysis capability can be provided for Excel, the convenience of SQL query operation can be effectively improved, and data analysis efficiency and user experience are improved.

[0096] Further, based on the data analysis method provided in the foregoing embodiments, the embodiments of the present application can also correspondingly provide a data analysis device. The data analysis device will be described below in combination with embodiments and drawings.

[0097] Figure 4 A structural schematic diagram of a data analysis device provided in the embodiments of the present application is shown. As shown in the figure, the data analysis device 400 provided in the embodiments of the present application comprises: Figure 4

[0098] A data table acquisition module 401, configured to acquire a first data table from an electronic spreadsheet program;

[0099] A format conversion module 402, configured to perform conversion processing on the first data table according to a target format to obtain a second data table, the target format being a file format supported by a target database, and the target database having a SQL query function;

[0100] A data table registration module 403, configured to register the second data table to the target database;

[0101] A SQL query module 404, configured to perform a SQL query operation on the second data table through the target database in the electronic spreadsheet program to obtain a query result;

[0102] A data output module 405, configured to output the query result through the electronic spreadsheet program.

[0103] Optionally, the target database performs the database query operation through a binary encoding format WebAssembly, and the WebAssembly runs in a web page.

[0104] Optionally, the data analysis device 400 further comprises:

[0105] A thread starting module, configured to start a service thread Service Worker in the web page, and the Service Worker communicates with a server;

[0106] A first resource acquisition module, configured to acquire, through the Service Worker, a database resource corresponding to a first resource loading request from the server in response to the first resource loading request, the first resource loading request being a resource loading request sent when the web page is first opened.​

[0107] The resource storage module is used to store the database resources locally on the web page.

[0108] Optionally, the data analysis device 400 further includes:

[0109] a resource interception module, configured to, in response to a second resource loading request, intercept and process the second resource loading request through the Service Worker, and redirect the second resource loading request to the database resource, where the second resource loading request is not a resource loading request sent when the webpage is opened for the first time;

[0110] The second resource acquisition module is configured to acquire the resource corresponding to the second resource loading request from the database resources.

[0111] Optionally, the database resources include web page execution resources and user usage data in the target database, wherein the web page execution resources include the WebAssembly execution code and the execution resources required for the web page, and the usage data includes the user's SQL scripts in different workspaces of the target database and the user's historical access information and configuration information to the target database.

[0112] The resource storage module is specifically used to:

[0113] The webpage running resources are stored in the local cache mechanism CacheStorage of the webpage, the SQL script is stored in the local database IndexedDB of the webpage, and the usage data is stored in the local key-value pair storage mechanism LocalStorage of the webpage.

[0114] Optionally, the first data table includes a plurality of tables;

[0115] The format conversion module 402 is specifically configured to:

[0116] The names of the plurality of tables are respectively used as the names of the plurality of second data tables, and the contents of the plurality of tables are respectively converted according to the target format to obtain the plurality of second data tables.

[0117] Optionally, the target format is comma-separated values ​​(CSV), the first data table includes a target cell, and the target cell includes at least one of the following target characters: an English double quote, a line break, and an English comma;

[0118] The format conversion module 402 is specifically configured to:

[0119] The content corresponding to the target character pair is surrounded by a preset character corresponding to the target format, and the English double quotation marks are escaped if the target character in the target cell includes the English double quotation marks, to obtain the second data table.

[0120] Optionally, the SQL query module 404 is specifically configured to:

[0121] receive a SQL query statement, the SQL query statement including a plurality of SQL sub-statements;

[0122] parse the plurality of SQL sub-statements to obtain structure information of each SQL sub-statement in the plurality of SQL sub-statements;

[0123] receive a query parameter corresponding to the SQL query operation;

[0124] execute the SQL query operation based on the structure information of each SQL sub-statement and the query parameter in the spreadsheet program to obtain a query result corresponding to each SQL sub-statement.

[0125] The structure of the control device implementing the above data synchronization method will be introduced below in the form of a server and a terminal device.

[0126] Figure 5 A server structure diagram provided by the embodiments of the present application, the server 900 can be quite different due to different configurations or performances, and can include one or more central processing units (CPU) 922 (for example, one or more processors) and a memory 932, one or more storage media 930 (for example, one or more mass storage devices) storing application programs 942 or data 944. Among them, the memory 932 and the storage medium 930 can be temporary storage or persistent storage. The programs stored in the storage medium 930 can include one or more modules (not shown in the figure), each module can include a series of instruction operations in the server. Further, the central processing unit 922 can be configured to communicate with the storage medium 930 to execute a series of instruction operations in the storage medium 930 on the server 900.

[0127] The server 900 can also include one or more power supplies 926, one or more wired or wireless network interfaces 950, one or more input / output interfaces 958, and / or one or more operating systems 941, such as Windows Server TM , Mac OS X TM , Unix TM , LinuxTM , FreeBSD TM etc.

[0128] The steps performed by the server in the above embodiment can be based on the Figure 5 The server structure shown.

[0129] The CPU 922 is used for the following steps:

[0130] Obtain a first data table from a spreadsheet program;

[0131] Converting the first data table into a second data table according to a target format, wherein the target format is a file format supported by a target database having a structured query language SQL query function;

[0132] registering the second data table to the target database;

[0133] In the spreadsheet program, executing an SQL query operation on the second data table through the target database to obtain a query result;

[0134] The query result is outputted through the electronic spreadsheet program.

[0135] The present application also provides another control device, such as Figure 6 For ease of explanation, only the parts related to the embodiments of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of this application. The terminal can be any terminal device including a mobile phone, tablet computer, personal digital assistant (PDA), point of sales (POS), vehicle-mounted computer, etc. Taking the mobile phone as an example:

[0136] Figure 6 The block diagram shows a partial structure of a mobile phone related to the terminal provided in the embodiment of the present application. Figure 6 The mobile phone includes components such as a radio frequency (RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, a wireless fidelity (WiFi) module 1070, a processor 1080, and a power supply 1090. Those skilled in the art will appreciate that Figure 6 The mobile phone structure shown in the figure does not constitute a limitation to the mobile phone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0137] The following will be described in detail Figure 6 The various components of the mobile phone will be described in detail:

[0138] The RF circuit 1010 can be used for receiving and sending signals in the process of information or communication, in particular, receiving the downlink information of the base station and processing it by the processor 1080; in addition, sending the uplink data to the base station. Generally, the RF circuit 1010 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 1010 can also communicate with the network and other devices through wireless communication. The above wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.

[0139] The memory 1020 can be used to store software programs and modules, and the processor 1080 executes various functions of the mobile phone and data processing by running the software programs and modules stored in the memory 1020. The memory 1020 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 1020 can include a high-speed random access memory, and can also include a non-volatile memory, for example, at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device.

[0140] The input unit 1030 can be used to receive inputted digital or character information, and to generate key signal input with respect to user setting of the mobile phone and function control. Specifically, the input unit 1030 can include a touch panel 1031 and other input devices 1032. The touch panel 1031, also called a touch screen, can collect touch operations (such as operations of a user using a finger, a stylus, or any suitable object or accessory on or near the touch panel 1031) of the user on or near it, and drive the corresponding connection device according to the pre-set program. Optionally, the touch panel 1031 can include two parts, a touch detection device and a touch controller. The touch detection device detects the touch position of the user and detects the signal caused by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch coordinates, and sends it to the processor 1080, and can also receive commands from the processor 1080 and execute them. In addition, the touch panel 1031 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 1031, the input unit 1030 can also include other input devices 1032. Specifically, the other input devices 1032 can include one or more of a physical keyboard, function keys (such as volume control keys, on / off keys, etc.), trackballs, mice, joysticks, etc.

[0141] The display unit 1040 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 1040 can include a display panel 1041, which can be configured in the form of a liquid crystal display (English full name: Liquid Crystal Display, English abbreviation: LCD), an organic light-emitting diode (English full name: Organic Light-Emitting Diode, English abbreviation: OLED), etc. Further, the touch panel 1031 can cover the display panel 1041, and when the touch panel 1031 detects a touch operation on or near it, it transmits to the processor 1080 to determine the type of touch event, and then the processor 1080 provides corresponding visual output on the display panel 1041 according to the type of touch event. Although in the Figure 6 In some embodiments, the touch panel 1031 and the display panel 1041 can be integrated to realize the input and output functions of the mobile phone.

[0142] The phone can also include at least one sensor 1050, such as an optical sensor, a motion sensor, and other sensors. Specifically, the optical sensor can include an ambient light sensor to adjust the brightness of the display panel 1041 according to the brightness of ambient light, and a proximity sensor to turn off the display panel 1041 and / or the backlight when the phone is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (usually three axes), and when at rest, it can detect the magnitude and direction of gravity, which can be used for applications such as identifying the phone posture (such as switching between landscape and portrait, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), and the like. As for other sensors that the phone can also be configured, such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, and the like, they will not be described here.

[0143] The audio circuit 1060, the speaker 1061, and the microphone 1062 can provide an audio interface between the user and the phone. The audio circuit 1060 can convert the received audio data into an electrical signal, transmit it to the speaker 1061, and convert it into a sound signal output by the speaker 1061; on the other hand, the microphone 1062 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1060 and converted into audio data, which is then output to the processor 1080 for processing, and then transmitted to another phone via the RF circuit 1010, or output to the memory 1020 for further processing.

[0144] WiFi is a short-range wireless transmission technology. The WiFi module 1070 can help users send and receive emails, browse web pages, and access streaming media, etc. It provides users with wireless broadband Internet access. Although Figure 6 The WiFi module 1070 is shown, but it is understood that it does not belong to the necessary components of the phone, and can be omitted as needed without changing the essence of the invention.

[0145] The processor 1080 is the control center of the phone, which connects all parts of the phone through various interfaces and lines, executes various functions of the phone and processes data by running or executing software programs and / or modules stored in the memory 1020, and calling data stored in the memory 1020, thereby collecting overall data and information of the phone. Optionally, the processor 1080 can include one or more processing units; preferably, the processor 1080 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 1080.

[0146] The mobile phone further includes a power supply 1090 (such as a battery) for supplying power to various components, and preferably, the power supply is logically connected to the processor 1080 through a power management system, so that the power management system can be used to manage charging, discharging, power consumption management, and the like.

[0147] Although not shown, the mobile phone can further include a camera, a Bluetooth module, and the like, which will not be described herein.

[0148] In the embodiments of the present application, the processor 1080 included in the terminal further has the following functions:

[0149] Obtaining a first data table from a spreadsheet program;

[0150] Converting the first data table according to a target format to obtain a second data table, the target format being a file format supported by a target database, the target database having a structured query language (SQL) query function;

[0151] Registering the second data table to the target database;

[0152] In the spreadsheet program, performing an SQL query operation on the second data table through the target database to obtain a query result;

[0153] Outputting the query result through the spreadsheet program.

[0154] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program having a predetermined function, and works together with other related parts to achieve a predetermined target, and can be implemented entirely or partially by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit that includes the functions of the module or unit.

[0155] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be described herein.

[0156] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other manners. For example, the described device embodiments are merely schematic. The division of the units is merely a logical function division. There can be another division manner for the actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or other forms.

[0157] The units described as separated components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments of the present application.

[0158] In addition, each functional unit in the embodiments of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware, or in the form of software functional units.

[0159] When the integrated unit is implemented in the form of software functional units and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such an understanding, the technical solutions of the present application essentially, or the part that contributes to the prior art, or all or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: U disk, mobile hard disk, read-only memory (English full name: Read-Only Memory, English abbreviation: ROM), random access memory (English full name: Random Access Memory, English abbreviation: RAM), magnetic disk or optical disk, and various program codes that can be stored in the medium.

[0160] The above examples are only used to illustrate the technical solutions of the present application, but not to limit the same; although the present application has been described in detail with reference to the foregoing examples, it should be understood by those of ordinary skill in the art that: it can still modify the technical solutions recorded in the foregoing examples, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A data analysis method, characterized in that: include: Obtain a first data table from a spreadsheet program; Converting the first data table into a second data table according to a target format, wherein the target format is a file format supported by a target database having a structured query language SQL query function; registering the second data table to the target database; In the spreadsheet program, executing an SQL query operation on the second data table through the target database to obtain a query result; The query result is outputted through the electronic spreadsheet program.

2. The data analysis method according to claim 1, characterized in that The target database executes the database query operation through the binary encoding format WebAssembly, and the WebAssembly runs on a web page.

3. The data analysis method according to claim 2, characterized in that: Before obtaining the first data table from the spreadsheet program, the method further includes: Starting a service worker thread in the webpage, wherein the service worker communicates with the server; In response to a first resource loading request, obtaining, through the Service Worker, a database resource corresponding to the first resource loading request from a server, where the first resource loading request is a resource loading request sent when the webpage is first opened; The database resource is stored locally on the web page.

4. The data analysis method according to claim 3, characterized in that: After the webpage locally stores the database resource, the method further includes: In response to a second resource loading request, intercepting and processing the second resource loading request by the Service Worker, and redirecting the second resource loading request to the database resource, where the second resource loading request is not a resource loading request sent when the webpage is opened for the first time; The resource corresponding to the second resource loading request is obtained from the database resource.

5. The data analysis method according to claim 3 or 4, characterized in that: The database resources include web page running resources and user usage data in the target database. The web page running resources include the WebAssembly running code and the running resources required for the web page. The usage data includes the SQL scripts of the user in different workspaces of the target database and the user's historical access information and configuration information to the target database. Storing the database resource locally on the webpage includes: The webpage running resources are stored in the local cache mechanism CacheStorage of the webpage, the SQL script is stored in the local database IndexedDB of the webpage, and the usage data is stored in the local key-value pair storage mechanism LocalStorage of the webpage.

6. The data analysis method according to any one of claims 1 to 4, characterized in that: The first data table includes a plurality of tables; The converting the first data table according to the target format to obtain the second data table includes: The names of the plurality of tables are respectively used as the names of the plurality of second data tables, and the contents of the plurality of tables are respectively converted according to the target format to obtain the plurality of second data tables.

7. The data analysis method according to any one of claims 1 to 4, characterized in that: The target format is comma-separated values ​​(CSV), the first data table includes a target cell, and the target cell includes at least one of the following target characters: an English double quote, a line break, and an English comma; The converting the first data table according to the target format to obtain the second data table includes: The content corresponding to the target characters is surrounded by the preset characters corresponding to the target format, and when the target characters in the target cell include the English double quotation marks, the English double quotation marks are escaped to obtain the second data table.

8. The data analysis method according to any one of claims 1 to 4, characterized in that: In the spreadsheet program, performing an SQL query operation on the second data table through the target database to obtain a query result includes: Receive an SQL query statement, where the SQL query statement includes multiple SQL sub-statements; Parsing the multiple SQL sub-statements to obtain structural information of each SQL sub-statement in the multiple SQL sub-statements; Receive query parameters corresponding to the SQL query operation; In the spreadsheet program, the SQL query operation is executed based on the structural information of each SQL sub-statement and the query parameters to obtain a query result corresponding to each SQL sub-statement.

9. A data analysis device, characterized in that: include: A data table acquisition module, configured to acquire a first data table from a spreadsheet program; a format conversion module, configured to convert the first data table into a second data table according to a target format, wherein the target format is a file format supported by a target database having a structured query language SQL query function; A data table registration module, configured to register the second data table in the target database; An SQL query module is used to execute an SQL query operation on the second data table through the target database in the electronic spreadsheet program to obtain a query result; A data output module is used to output the query result through the electronic spreadsheet program.

10. An electronic device, characterized in that: The device includes a processor and a memory: The memory is used to store a computer program and transmit the computer program to the processor; The processor is configured to execute the steps of the data analysis method according to any one of claims 1 to 8 according to the instructions in the computer program.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store a computer program, and when the computer program is executed by a terminal device, the steps of the data analysis method according to any one of claims 1 to 8 are implemented.

12. A computer program product, characterized in that The invention comprises a computer program which, when executed by a terminal device, implements the steps of the data analysis method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Bidding response file-oriented multi-type document structured analysis method and system

    CN121579656A