How an AI-Powered Bot Turns Excel Files into Interactive Reports
This article introduces an AI‑driven Smart Report Assistant Bot that automatically converts uploaded Excel files into recommended charts, allows users to customize reports, and details the underlying workflow—including Excel parsing, LLM‑generated SQL, dynamic table creation, chart rendering with ECharts, and image‑merging plugins.
Background
There are many reporting tools on the market, but most are difficult for ordinary users to master. The Smart Report Assistant Bot requires only an Excel upload to automatically generate reports that users might need. If the suggested report is not what the user wants, they can type a custom request and the bot will generate it.
Bot demo address: https://www.coze.cn/store/bot/7388406006914727976?bid=6dccmqrok7g1v&panel=1
Feature Demo
Upload Excel File
Prepare an Excel file:
Upload the Excel file:
After uploading, the data is parsed and a report is generated:
Clicking a chart opens an interactive web page where users can delete unwanted charts by title, add new analyses, and view the updated report.
Implementation Process
Persona & Reply Logic
Quick Commands
Quick command buttons improve user experience compared to typing text.
Configuration of quick commands:
Workflow
The bot’s core consists of four workflows corresponding to the four main functions.
Parsing Excel Data and Generating Reports
When a user uploads an Excel file, the workflow obtains the file URL, downloads it via a plugin, and reads its contents.
Initially I tried storing each cell in the bot’s database and letting a large model answer questions directly, but the model often produced calculation errors (e.g., incorrect averages).
Switching to a different approach, I converted the Excel data into a relational table, used the large model to translate user questions into SQL, and achieved high accuracy.
Because Coze cannot create tables dynamically, I built an external service that creates a table from the Excel URL, inserts the data, and returns the dynamic table name, which is stored in Coze’s database for later queries.
Using the table schema, the model generates three recommended reports, each containing a title, description, and query SQL. To avoid sending too much data to the model (which could cause crashes), the result set is limited to 100 rows.
After obtaining the SQL, a plugin executes it, and the resulting data, together with the report title, is fed to the model to generate parameters for an ECharts chart.
The official chart plugin produced blurry images, so I wrote a custom plugin that scales the chart three times, resulting in much clearer pictures.
To merge multiple chart images into a single large image, I created another plugin because the image‑stream service only supports overlay, not composition.
After generating a chart, its URL is stored in the database for later retrieval.
Key Details
The large model may generate erroneous SQL; when execution fails, capture the error message and feed both the faulty SQL and the error back to the model for correction.
The model’s generated JSON may be non‑standard; the same correction approach can be applied.
Viewing, Deleting, and Adding Charts
To view reports, query stored chart URLs from the database and use the image‑merging plugin to combine them into a single large image.
To delete a chart, remove its URL from the database based on the user‑provided title.
Adding a chart follows the same flow as the initial Excel‑to‑report process, except the SQL is generated from a user‑specified title rather than from model‑suggested titles.
Future Plans
Currently the bot only supports Excel files; future versions will add support for database connections and cloud documents from various platforms.
Original article: https://developer.volcengine.com/articles/7388464144309026853
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Volcano Engine Developer Services
The Volcano Engine Developer Community, Volcano Engine's TOD community, connects the platform with developers, offering cutting-edge tech content and diverse events, nurturing a vibrant developer culture, and co-building an open-source ecosystem.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
