<cite id="ffb66"></cite><cite id="ffb66"><track id="ffb66"></track></cite>
      <legend id="ffb66"><li id="ffb66"></li></legend>
      色婷婷久,激情色播,久久久无码专区,亚洲中文字幕av,国产成人A片,av无码免费,精品久久国产,99视频精品3
      網易首頁 > 網易號 > 正文 申請入駐

      Deepseek嵌入Excel,幫你自動做表格,感覺我要失業了

      0
      分享至

      之前跟大家分享了, 如何將Deepseek嵌入Word,有粉絲就問道如何將Deepseek嵌入到Excel呢?這不,今天方法就來了,跟嵌入Word的使用方法類似



      一、使用方法

      先來簡單地說下使用的方法,操作非常的簡單,跟嵌入Word類似

      首先我們需要先選中對應的數據區域,然后在上方點擊Deepseek,最后會跳出窗口,在窗口中提出問題,等待一段時間后就能得到對應的結果了,下面來看下如何構建這個效果



      二、代碼準備

      首先需要復制下方的代碼,關鍵點是需要修改API為自己的API,如何獲取API的話,大家可以翻下之前的文章,是需要在Deepseek的官網獲取的。

      api_key = "你的api"

      在這里將你的api直接替換為deepseek的api秘鑰即可

      Function CallDeepSeekAPI(api_key As String, inputText As String) As String
      Dim API As String
      Dim SendTxt As String
      Dim Http As Object
      Dim status_code As Integer
      Dim response As String
      API = "https://api.deepseek.com/chat/completions"
      SendTxt = "{""model"": ""deepseek-chat"", ""messages"": [{""role"":""system"", ""content"":""You are a Excel assistant""}, {""role"":""user"", ""content"":""" & inputText & """}], ""stream"": false}"
      Set Http = CreateObject("MSXML2.XMLHTTP")
      With Http
      .Open "POST", API, False
      .setRequestHeader "Content-Type", "application/json"
      .setRequestHeader "Authorization", "Bearer " & api_key
      .send SendTxt
      status_code = .Status
      response = .responseText
      End With
      If status_code = 200 Then
      CallDeepSeekAPI = response
      Else
      CallDeepSeekAPI = "Error: " & status_code & " - " & response
      End If
      Set Http = Nothing
      End Function
      Sub DeepSeekExcel()
      Dim api_key As String
      Dim userQuestion As String
      Dim selectedRange As Range
      Dim cell As Range
      Dim combinedInput As String
      Dim response As String
      Dim regex As Object
      Dim matches As Object
      api_key = "你的api"
      If api_key = "" Then
      MsgBox "請先設置API密鑰", vbExclamation
      Exit Sub
      End If
      On Error Resume Next
      Set selectedRange = Selection
      On Error GoTo 0
      If selectedRange Is Nothing Then
      MsgBox "請先選擇要處理的數據區域", vbExclamation
      Exit Sub
      End If
      userQuestion = InputBox("請輸入您的問題(選中的單元格內容將作為處理數據):", "DeepSeek 提問")
      If userQuestion = "" Then Exit Sub
      Set regex = CreateObject("VBScript.RegExp")
      regex.Pattern = """content"":""(.*?)"""
      regex.Global = False
      regex.MultiLine = True
      Application.ScreenUpdating = False
      For Each cell In selectedRange
      If Trim(cell.Value) <> "" Then
      ' 組合問題和單元格內容
      combinedInput = userQuestion & vbCrLf & vbCrLf & "數據內容:" & vbCrLf & cell.Value
      ' 轉義特殊字符
      combinedInput = Replace(combinedInput, "\", "\\")
      combinedInput = Replace(combinedInput, """", "\""")
      combinedInput = Replace(combinedInput, vbCrLf, "\n")
      combinedInput = Replace(combinedInput, vbCr, "\n")
      combinedInput = Replace(combinedInput, vbLf, "\n")
      ' 調用API
      response = CallDeepSeekAPI(api_key, combinedInput)
      If Left(response, 5) <> "Error" Then
      Set matches = regex.Execute(response)
      If matches.Count > 0 Then
      Dim outputText As String
      outputText = matches(0).SubMatches(0)
      ' 處理轉義字符
      outputText = Replace(outputText, "\""", """")
      outputText = Replace(outputText, "\\", "\")
      outputText = Replace(outputText, "\n", vbCrLf)
      ' 寫入右側相鄰單元格
      cell.Offset(0, 1).Value = outputText
      Else
      cell.Offset(0, 1).Value = "解析失敗"
      End If
      Else
      cell.Offset(0, 1).Value = "API錯誤"
      End If
      End If
      Next cell
      Application.ScreenUpdating = True
      MsgBox "處理完成!", vbInformation
      Set regex = Nothing
      Set selectedRange = Nothing
      End Sub

      Function CallDeepSeekAPI(api_key As String, inputText As String) As String Dim API As String Dim SendTxt As String Dim Http As Object Dim status_code As Integer Dim response As String API = "https://api.deepseek.com/chat/completions" SendTxt = "{""model"": ""deepseek-chat"", ""messages"": [{""role"":""system"", ""content"":""You are a Excel assistant""}, {""role"":""user"", ""content"":""" & inputText & """}], ""stream"": false}" Set Http = CreateObject("MSXML2.XMLHTTP") With Http .Open "POST", API, False .setRequestHeader "Content-Type", "application/json" .setRequestHeader "Authorization", "Bearer " & api_key .send SendTxt status_code = .Status response = .responseText End With If status_code = 200 Then CallDeepSeekAPI = response Else CallDeepSeekAPI = "Error: " & status_code & " - " & response End If Set Http = NothingEnd FunctionSub DeepSeekExcel() Dim api_key As String Dim userQuestion As String Dim selectedRange As Range Dim cell As Range Dim combinedInput As String Dim response As String Dim regex As Object Dim matches As Object api_key = "你的api" If api_key = "" Then MsgBox "請先設置API密鑰", vbExclamation Exit Sub End If On Error Resume Next Set selectedRange = Selection On Error GoTo 0 If selectedRange Is Nothing Then MsgBox "請先選擇要處理的數據區域", vbExclamation Exit Sub End If userQuestion = InputBox("請輸入您的問題(選中的單元格內容將作為處理數據):", "DeepSeek 提問") If userQuestion = "" Then Exit Sub Set regex = CreateObject("VBScript.RegExp") regex.Pattern = """content"":""(.*?)""" regex.Global = False regex.MultiLine = True Application.ScreenUpdating = False For Each cell In selectedRange If Trim(cell.Value) <> "" Then ' 組合問題和單元格內容 combinedInput = userQuestion & vbCrLf & vbCrLf & "數據內容:" & vbCrLf & cell.Value ' 轉義特殊字符 combinedInput = Replace(combinedInput, "\", "\\") combinedInput = Replace(combinedInput, """", "\""") combinedInput = Replace(combinedInput, vbCrLf, "\n") combinedInput = Replace(combinedInput, vbCr, "\n") combinedInput = Replace(combinedInput, vbLf, "\n") ' 調用API response = CallDeepSeekAPI(api_key, combinedInput) If Left(response, 5) <> "Error" Then Set matches = regex.Execute(response) If matches.Count > 0 Then Dim outputText As String outputText = matches(0).SubMatches(0) ' 處理轉義字符 outputText = Replace(outputText, "\""", """") outputText = Replace(outputText, "\\", "\") outputText = Replace(outputText, "\n", vbCrLf) ' 寫入右側相鄰單元格 cell.Offset(0, 1).Value = outputText Else cell.Offset(0, 1).Value = "解析失敗" End If Else cell.Offset(0, 1).Value = "API錯誤" End If End If Next cell Application.ScreenUpdating = True MsgBox "處理完成!", vbInformation Set regex = Nothing Set selectedRange = NothingEnd Sub

      三、代碼粘貼

      在Excel中點擊【開發工具】然后點擊【Visiual Basic】進入編輯窗口,在右側空白區域點擊鼠標右鍵找到插入,找到【模塊】,然后在右側的窗口那里直接粘貼即可

      在這里一定記得,API替換為自己的API



      四、制作按鈕

      需要在右側點擊文件,然后最下放找到【選項】來調出Excel選項,在Excel選項中找到【自定義功能區】

      我們需要在左側將類別設置【宏】選中【DEEPSeekExcel】這個宏,然后在右側的窗口中點擊對應的選項卡,最后點擊添加,即可將宏作為按鈕添加到Excel表格中,至此就設置完畢了



      五、加載宏

      如果想要將這個宏按鈕永久的保留在Excel中是需要使用加載宏的,之前發過,大家可以搜一下

      DeepSeek搭配Excel,制作自定義按鈕,實現辦公自動化!

      視頻Excel從零到一

      特別聲明:以上內容(如有圖片或視頻亦包括在內)為自媒體平臺“網易號”用戶上傳并發布,本平臺僅提供信息存儲服務。

      Notice: The content above (including the pictures and videos if any) is uploaded and posted by a user of NetEase Hao, which is a social media platform and only provides information storage services.

      相關推薦
      熱點推薦
      湖人棄將19+6斷登全美熱搜!多次生斷庫里致湖媒后悔 年薪僅234萬

      湖人棄將19+6斷登全美熱搜!多次生斷庫里致湖媒后悔 年薪僅234萬

      顏小白的籃球夢
      2026-04-18 13:23:57
      美財政部改口:延長一個月

      美財政部改口:延長一個月

      觀察者網
      2026-04-18 22:31:22
      電腦一管硅脂用十年引熱議!網友直呼太離譜

      電腦一管硅脂用十年引熱議!網友直呼太離譜

      游民星空
      2026-04-17 19:40:21
      煎餅攤被惡意競爭阻擋,網友發聲“如果我媽媽被這樣對待,受不了”,意外帶火攤位,攤主:非常感謝網友發聲

      煎餅攤被惡意競爭阻擋,網友發聲“如果我媽媽被這樣對待,受不了”,意外帶火攤位,攤主:非常感謝網友發聲

      瀟湘晨報
      2026-04-18 19:46:12
      太猖狂!天津有人深夜“涉黃”被抓!抓捕細節曝光…

      太猖狂!天津有人深夜“涉黃”被抓!抓捕細節曝光…

      天津族
      2026-04-18 07:32:54
      孔蒂:落后12分?保持目前的位置已屬不易;不會回應去留傳聞

      孔蒂:落后12分?保持目前的位置已屬不易;不會回應去留傳聞

      懂球帝
      2026-04-19 04:25:10
      48歲田蕊妮癌癥復發,自曝心情沉痛,評論區噓聲一片 互聯網有記

      48歲田蕊妮癌癥復發,自曝心情沉痛,評論區噓聲一片 互聯網有記

      小叨娛樂
      2026-04-19 06:01:17
      橘子海樂隊喊話華為:下架道歉賠償

      橘子海樂隊喊話華為:下架道歉賠償

      ZAKER新聞
      2026-04-17 17:12:59
      驚天大逆轉!中國國運爆發,百年機遇降臨,西方要慌了!

      驚天大逆轉!中國國運爆發,百年機遇降臨,西方要慌了!

      曉楖科普
      2026-04-18 16:06:36
      同事借我車去青海,我提前把ETC卡拔了,2小時后他從收費站來電了

      同事借我車去青海,我提前把ETC卡拔了,2小時后他從收費站來電了

      張道陵秘話
      2026-04-11 16:37:21
      6月1日交強險調整!950元固定費取消,好司機保費直接減掉一半

      6月1日交強險調整!950元固定費取消,好司機保費直接減掉一半

      復轉這些年
      2026-04-17 11:59:50
      大的要來了!穆杰塔巴擼掉伊朗革命衛隊總司令,換了個不怕死的

      大的要來了!穆杰塔巴擼掉伊朗革命衛隊總司令,換了個不怕死的

      杰絲聊古今
      2026-04-11 19:07:34
      狀態下滑+2768萬年薪!勇士離隊首人或出爐,庫里恐再失得力助手

      狀態下滑+2768萬年薪!勇士離隊首人或出爐,庫里恐再失得力助手

      大衛的籃球故事
      2026-04-18 18:49:04
      日本壟斷全球90%!一旦斷供,別國造不出,中國咋辦?

      日本壟斷全球90%!一旦斷供,別國造不出,中國咋辦?

      今墨緣
      2026-04-14 09:57:22
      卡里克:射正次數可能不夠多,但我認為我們甚至可能再進一球

      卡里克:射正次數可能不夠多,但我認為我們甚至可能再進一球

      懂球帝
      2026-04-19 06:43:58
      90分鐘戰報:馬競2-2皇社,小蜘蛛扳平比分,雙方進入加時

      90分鐘戰報:馬競2-2皇社,小蜘蛛扳平比分,雙方進入加時

      懂球帝
      2026-04-19 05:19:12
      未婚生子后,男子起訴女友,要求退還彩禮和分娩費

      未婚生子后,男子起訴女友,要求退還彩禮和分娩費

      中國新聞周刊
      2026-04-18 22:11:05
      核缺陣+41歲孤王+驚天交易!湖人越慘越爆

      核缺陣+41歲孤王+驚天交易!湖人越慘越爆

      茅塞盾開本尊
      2026-04-18 13:06:52
      為何紅軍到了陜北,蔣介石的幾十萬大軍就不死追了,這是為什么?

      為何紅軍到了陜北,蔣介石的幾十萬大軍就不死追了,這是為什么?

      瑩瑩的歷史說
      2026-04-19 03:15:42
      前首富貝索斯56歲老婆要為愛生娃?稱和丈夫恩愛與錢無關,開35億游艇度假被狂噴!

      前首富貝索斯56歲老婆要為愛生娃?稱和丈夫恩愛與錢無關,開35億游艇度假被狂噴!

      英國報姐
      2026-04-18 21:10:46
      2026-04-19 07:15:00
      Excel從零到一 incentive-icons
      Excel從零到一
      0基礎,0成本學習Excel
      581文章數 87214關注度
      往期回顧 全部

      科技要聞

      傳Meta下月擬裁8000 大舉清退人力為AI騰位

      頭條要聞

      伊朗革命衛隊向油輪開火 伊朗最高領袖發聲

      頭條要聞

      伊朗革命衛隊向油輪開火 伊朗最高領袖發聲

      體育要聞

      時隔25年重返英超!沒有人再嘲笑他了

      娛樂要聞

      劉德華回應潘宏彬去世,拒談喪禮細節

      財經要聞

      "影子萬科"2.0:管理層如何吸血萬物云?

      汽車要聞

      奇瑞威麟R08 PRO正式上市 售價14.48萬元起

      態度原創

      健康
      時尚
      數碼
      本地
      軍事航空

      干細胞抗衰4大誤區,90%的人都中招

      選對發型,真的能少走很多變美彎路

      數碼要聞

      華為版的科技春晚來了!Pura 90/Pura X Max下周發:陣容豪華

      本地新聞

      12噸巧克力有難,全網化身超級偵探添亂

      軍事要聞

      解放軍護衛艦與外艦纏斗20小時 細節披露

      無障礙瀏覽 進入關懷版