<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.

      相關推薦
      熱點推薦
      特朗普:已向伊朗告知達成協議的最后期限

      特朗普:已向伊朗告知達成協議的最后期限

      環球網資訊
      2026-01-31 05:34:37
      日媒:“高市早苗若靠人氣贏了,將是日本的不幸”全網聲討高市

      日媒:“高市早苗若靠人氣贏了,將是日本的不幸”全網聲討高市

      兩兄弟養牛
      2026-01-31 21:41:59
      昏迷13年后,“車王”舒馬赫被曝已蘇醒:“謝謝你,不曾放棄我”

      昏迷13年后,“車王”舒馬赫被曝已蘇醒:“謝謝你,不曾放棄我”

      阿訊說天下
      2026-01-29 00:08:50
      美國軍方大膽預測:突然曝光解放軍武力收臺時間,突然大幅度提前

      美國軍方大膽預測:突然曝光解放軍武力收臺時間,突然大幅度提前

      樂天閑聊
      2026-01-29 15:39:43
      55票反對45票贊成!美投票結果公布:特朗普態度轉變,美停止行動

      55票反對45票贊成!美投票結果公布:特朗普態度轉變,美停止行動

      一口娛樂
      2026-01-31 21:18:44
      警方終于回應了!否認金晨逃逸監控截圖,官方出手,這下麻煩大了

      警方終于回應了!否認金晨逃逸監控截圖,官方出手,這下麻煩大了

      觀察鑒娛
      2026-01-31 10:09:05
      山東險勝廣州贏在裁判:球隊要想走得更遠,兩點決定邱彪必須下課

      山東險勝廣州贏在裁判:球隊要想走得更遠,兩點決定邱彪必須下課

      姜大叔侃球
      2026-01-31 22:14:35
      26.78萬!奧迪官宣:新車正式上市

      26.78萬!奧迪官宣:新車正式上市

      高科技愛好者
      2026-01-30 23:10:48
      第四艘航母進展幾何?國防部回應看似“高冷”,實則釋放關鍵信號

      第四艘航母進展幾何?國防部回應看似“高冷”,實則釋放關鍵信號

      羅富強說
      2026-01-31 21:49:01
      兒子帶女友回家,女友頭發把媽媽嚇一跳,網友:這就是自我的代價

      兒子帶女友回家,女友頭發把媽媽嚇一跳,網友:這就是自我的代價

      丫頭舫
      2026-01-30 15:51:49
      只能賭一把麥基!廣東隊有望補強內線群,薩林杰也要留隊?

      只能賭一把麥基!廣東隊有望補強內線群,薩林杰也要留隊?

      緋雨兒
      2026-01-31 13:40:36
      凡人微光 | 熱氣騰騰的年味

      凡人微光 | 熱氣騰騰的年味

      新華社
      2026-01-30 11:22:34
      又現通宵排隊!早上7點半已排200多人,來豫園買黃金,只為搶到心儀款式!

      又現通宵排隊!早上7點半已排200多人,來豫園買黃金,只為搶到心儀款式!

      上海黃浦
      2026-01-31 21:04:47
      天呀,杜海濤竟然現成這樣了,沈夢辰對他是真愛啊

      天呀,杜海濤竟然現成這樣了,沈夢辰對他是真愛啊

      草莓解說體育
      2026-01-07 01:43:18
      回旋鏢扎自己身上是啥體驗?網友:有仇當天就報,心情爽極了

      回旋鏢扎自己身上是啥體驗?網友:有仇當天就報,心情爽極了

      帶你感受人間冷暖
      2026-01-26 00:05:20
      SpaceX申請一次發射最多100萬顆衛星,馬斯克稱“先從小處做起”

      SpaceX申請一次發射最多100萬顆衛星,馬斯克稱“先從小處做起”

      IT之家
      2026-01-31 16:28:47
      你錯過了哪些異性對你的暗示?網友:果然單身都是有理由的!

      你錯過了哪些異性對你的暗示?網友:果然單身都是有理由的!

      解讀熱點事件
      2025-11-08 17:33:23
      中大型MPV已上市,14.98萬起售!航空座椅帶腿托,外觀挺氣派

      中大型MPV已上市,14.98萬起售!航空座椅帶腿托,外觀挺氣派

      米粒說車唯一呀
      2026-01-31 18:00:05
      最后一個狀元劉春霖:中狀元后大清就亡了,他在民國受怎樣待遇?

      最后一個狀元劉春霖:中狀元后大清就亡了,他在民國受怎樣待遇?

      興趣知識
      2026-01-31 11:34:00
      為什么美國、日本第一時間就知道中國的決策、軍事及重大的工程等

      為什么美國、日本第一時間就知道中國的決策、軍事及重大的工程等

      今墨緣
      2026-01-30 12:45:45
      2026-01-31 22:32:49
      Excel從零到一 incentive-icons
      Excel從零到一
      0基礎,0成本學習Excel
      580文章數 87190關注度
      往期回顧 全部

      科技要聞

      SpaceX申請部署百萬衛星 打造太空數據中心

      頭條要聞

      夫妻買房2年后才得知發生過兩起墜樓:不敢在家里住了

      頭條要聞

      夫妻買房2年后才得知發生過兩起墜樓:不敢在家里住了

      體育要聞

      新時代得分王!東皇37+三雙刷7紀錄怒吼釋放

      娛樂要聞

      李維嘉、吳昕、汪涵現身魏文彬追悼會

      財經要聞

      白銀,暴跌!黃金,40年最大跌幅!

      汽車要聞

      新款賓利歐陸GT S/GTC S官圖發布 V8混動加持

      態度原創

      手機
      旅游
      時尚
      親子
      軍事航空

      手機要聞

      iPhone Fold配備5500mAh電池:蘋果手機史上最大電量

      旅游要聞

      南京紫金山驚現霧凇美景

      10個瞬間,回顧這一年

      親子要聞

      丈母娘做一鍋海帶排骨,一桌家常菜太豐盛,龍寶調皮不好好吃飯?

      軍事要聞

      特朗普稱龐大艦隊駛向伊朗 已超委內瑞拉

      無障礙瀏覽 進入關懷版