šŸ“§Univer Go: Spreadsheet combined with AI, automatically extract information and send emails

Ā·

4 min read

Unlock the spreadsheet that will automatically send emailsļ¼š

HišŸ‘‹, Iā€™d like to introduce a template developed based on Univer Go ā€”AI Email. By integrating the Phidata API, it can intelligently access AI services, automatically extract key information from Univer Sheets, and send emails, making office automation effortless. Whether it's automatic replies, sales follow-ups, recruitment management, or contract reminders, it significantly improves work efficiency and response speed, helping businesses and individuals say goodbye to tedious tasks and embrace a new, efficient, and intelligent way of working.

In Univer Go's operation interface, you only need to click to run the AI Email script to automatically extract key information and send emails. Not only that, Univer Go also gives you the ability to deeply customize the script, so that the tool in your hand can really be used for your own benefit. Whether you are dealing with complex business processes or turning creative work ideas into reality, it can accurately match your diverse needs and achieve your goals efficiently and easily.

Click to view AI template video: Univer Go Intelligent Data Completion and Real-time Information Extraction

Univer Go is a highly customizable spreadsheet tool that can build a spreadsheet with performance and functionality comparable to Excel based on user needs. It supports flexible functional expansion, covering basic data processing, complex import and export operations, and collaborative functions, while providing customization space for UI/UX design to help create an easy-to-use interactive interface.

In addition, Univer Go integrates advanced AI technologies and comes with powerful script writing and execution tools. It supports developers in creating and running automation scripts, connecting to databases, managing data reading and writing, and developing custom applications. Whether you're a beginner or a professional developer, its simple operation logic and rich feature support make it easy to get started.

Experience link: Univer Go

Implementing AI Emaliļ¼š

  1. Client script custom interaction components
    const ui = univerAPI.getUi();

    //Trigger the Univer sheet AI prompt assistant based on the selected cell data
    const AIPrompt = ui.createAIPrompt().setCustomStyles({'width': halfBodyWidth}).onSubmit(async (message) => {
        dialog.close();
        LoadingAnimation();
        AIPrompt.success(`Success: ${message}`);
        aiComplete();
    });
  1. The python server script provides AI interactive services and accesses the GPT API to return results based on the prompt words and cell data
from phi.agent import Agent, RunResponse
from phi.model.openai.like import OpenAILike
from pydantic import BaseModel, Field

def gpt(query: str):
    gpt_agent = Agent(
        name="GPT Agent",
        model=OpenAILike(
            id=os.getenv('AI_MODLE'),
            api_key=os.getenv('AI_API_KEY'),
            base_url=os.getenv('AI_API_URL'),
        ),
        instructions=["Ask a question and get an answer, give me the briefest answer."],
    )
  1. The client script reads the unit data and calls the python script to interact with the AI
 //Read Data
  const workbook = univerAPI.getActiveWorkbook();
    const sheet = workbook.getActiveSheet();
    const originData = sheet.getRange('A1:A10');
    // Get all current values from the range
    const values = originData.getValues();
    // Get the values from originData
    const data = values.flat();

  // Call the API and request AI to return data
    const nameRes = await univerAPI.runOnServer('py', 'gpt', `get a user name from given text, NOTE: you should ONLY output a name: <text>${val}</text>`);

  // Call the Universe sheet cell write API to write back data
  nameCell.setValue(name);
        executeProgress(i++, dataCount);
        setAiStatus(nameCell.getRow(), nameCell.getColumn(), getRandomInt());
  1. Client script sends e-mail
   // Call emailjs to write back the email      
        emailjs.send(
            'your servic id', //  servic id
            'your template id',  //  template id
            {
                message: data,
                name: name,
                send_to:email,
            },
        )

Ready-made templates for quick useļ¼

  1. Please download Univer Go first, find AI Email in the template, and click to use it

    Download Linkļ¼šUniver Go

  2. The code editor is displayed on the right, which provides AI-assisted API writing, syntax highlighting, code folding and other functions to help developers write, debug and maintain code more efficiently.

    To learn more about AI assisted writing, please read this articleļ¼šUniver Go Launches AI-Powered API Writing Assistance

  3. Adjust the code, preview the table, and run the code

  1. Select the information to be processed in the preview table and click the "AI" button in the upper right corner of the selection area.

  1. Enter a prompt such as "Please extract the candidate's name, email address, and generate an email to be sent." Click OK and wait for analysis. During this period, there will be a progress indicator in the upper right corner, and the returned results will be updated in real time to the cell.

  1. After the analysis is completed and all cells have updated their data, you can click the "Send Email" option in the interactive box in the upper right corner.

  1. Select the person you want to send the email to, click "Send Email" and observe the sending status.

    1. There will be prompts for successful or failed sending

  1. The above simple steps can help you easily send emails automatically from tables! Log in to Univer Go now to explore a variety of customized functions and start a new experience of efficient office!
Ā