<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
      網(wǎng)易首頁(yè) > 網(wǎng)易號(hào) > 正文 申請(qǐng)入駐

      Deepseek嵌入Excel,幫你自動(dòng)做表格,感覺我要失業(yè)了

      0
      分享至

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



      一、使用方法

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

      首先我們需要先選中對(duì)應(yīng)的數(shù)據(jù)區(qū)域,然后在上方點(diǎn)擊Deepseek,最后會(huì)跳出窗口,在窗口中提出問題,等待一段時(shí)間后就能得到對(duì)應(yīng)的結(jié)果了,下面來看下如何構(gòu)建這個(gè)效果



      二、代碼準(zhǔn)備

      首先需要復(fù)制下方的代碼,關(guān)鍵點(diǎn)是需要修改API為自己的API,如何獲取API的話,大家可以翻下之前的文章,是需要在Deepseek的官網(wǎng)獲取的。

      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 "請(qǐng)先設(shè)置API密鑰", vbExclamation
      Exit Sub
      End If
      On Error Resume Next
      Set selectedRange = Selection
      On Error GoTo 0
      If selectedRange Is Nothing Then
      MsgBox "請(qǐng)先選擇要處理的數(shù)據(jù)區(qū)域", vbExclamation
      Exit Sub
      End If
      userQuestion = InputBox("請(qǐng)輸入您的問題(選中的單元格內(nèi)容將作為處理數(shù)據(jù)):", "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
      ' 組合問題和單元格內(nèi)容
      combinedInput = userQuestion & vbCrLf & vbCrLf & "數(shù)據(jù)內(nèi)容:" & vbCrLf & cell.Value
      ' 轉(zhuǎn)義特殊字符
      combinedInput = Replace(combinedInput, "\", "\\")
      combinedInput = Replace(combinedInput, """", "\""")
      combinedInput = Replace(combinedInput, vbCrLf, "\n")
      combinedInput = Replace(combinedInput, vbCr, "\n")
      combinedInput = Replace(combinedInput, vbLf, "\n")
      ' 調(diào)用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)
      ' 處理轉(zhuǎn)義字符
      outputText = Replace(outputText, "\""", """")
      outputText = Replace(outputText, "\\", "\")
      outputText = Replace(outputText, "\n", vbCrLf)
      ' 寫入右側(cè)相鄰單元格
      cell.Offset(0, 1).Value = outputText
      Else
      cell.Offset(0, 1).Value = "解析失敗"
      End If
      Else
      cell.Offset(0, 1).Value = "API錯(cuò)誤"
      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 "請(qǐng)先設(shè)置API密鑰", vbExclamation Exit Sub End If On Error Resume Next Set selectedRange = Selection On Error GoTo 0 If selectedRange Is Nothing Then MsgBox "請(qǐng)先選擇要處理的數(shù)據(jù)區(qū)域", vbExclamation Exit Sub End If userQuestion = InputBox("請(qǐng)輸入您的問題(選中的單元格內(nèi)容將作為處理數(shù)據(jù)):", "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 ' 組合問題和單元格內(nèi)容 combinedInput = userQuestion & vbCrLf & vbCrLf & "數(shù)據(jù)內(nèi)容:" & vbCrLf & cell.Value ' 轉(zhuǎn)義特殊字符 combinedInput = Replace(combinedInput, "\", "\\") combinedInput = Replace(combinedInput, """", "\""") combinedInput = Replace(combinedInput, vbCrLf, "\n") combinedInput = Replace(combinedInput, vbCr, "\n") combinedInput = Replace(combinedInput, vbLf, "\n") ' 調(diào)用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) ' 處理轉(zhuǎn)義字符 outputText = Replace(outputText, "\""", """") outputText = Replace(outputText, "\\", "\") outputText = Replace(outputText, "\n", vbCrLf) ' 寫入右側(cè)相鄰單元格 cell.Offset(0, 1).Value = outputText Else cell.Offset(0, 1).Value = "解析失敗" End If Else cell.Offset(0, 1).Value = "API錯(cuò)誤" End If End If Next cell Application.ScreenUpdating = True MsgBox "處理完成!", vbInformation Set regex = Nothing Set selectedRange = NothingEnd Sub

      三、代碼粘貼

      在Excel中點(diǎn)擊【開發(fā)工具】然后點(diǎn)擊【Visiual Basic】進(jìn)入編輯窗口,在右側(cè)空白區(qū)域點(diǎn)擊鼠標(biāo)右鍵找到插入,找到【模塊】,然后在右側(cè)的窗口那里直接粘貼即可

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



      四、制作按鈕

      需要在右側(cè)點(diǎn)擊文件,然后最下放找到【選項(xiàng)】來調(diào)出Excel選項(xiàng),在Excel選項(xiàng)中找到【自定義功能區(qū)】

      我們需要在左側(cè)將類別設(shè)置【宏】選中【DEEPSeekExcel】這個(gè)宏,然后在右側(cè)的窗口中點(diǎn)擊對(duì)應(yīng)的選項(xiàng)卡,最后點(diǎn)擊添加,即可將宏作為按鈕添加到Excel表格中,至此就設(shè)置完畢了



      五、加載宏

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

      DeepSeek搭配Excel,制作自定義按鈕,實(shí)現(xiàn)辦公自動(dòng)化!

      視頻Excel從零到一

      特別聲明:以上內(nèi)容(如有圖片或視頻亦包括在內(nèi))為自媒體平臺(tái)“網(wǎng)易號(hào)”用戶上傳并發(fā)布,本平臺(tái)僅提供信息存儲(chǔ)服務(wù)。

      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.

      相關(guān)推薦
      熱點(diǎn)推薦
      梅根曬娃用花擋住正臉,遭全網(wǎng)炮轟:別再拿孩子當(dāng)博眼球的工具

      梅根曬娃用花擋住正臉,遭全網(wǎng)炮轟:別再拿孩子當(dāng)博眼球的工具

      世界王室那些事
      2026-03-20 18:07:53
      年薪60萬(wàn)男子找36名同事借款200萬(wàn)被辭退,起訴公司索賠240多萬(wàn)

      年薪60萬(wàn)男子找36名同事借款200萬(wàn)被辭退,起訴公司索賠240多萬(wàn)

      半島晨報(bào)
      2026-03-20 21:30:03
      紫蘇配黑豆煮水喝,身體悄悄變好,懂的人都在喝

      紫蘇配黑豆煮水喝,身體悄悄變好,懂的人都在喝

      開心美食白科
      2026-03-18 18:20:16
      親美派密謀推翻鄭麗文,朱立倫要另立黨中央,國(guó)民黨出現(xiàn)五個(gè)太陽(yáng)

      親美派密謀推翻鄭麗文,朱立倫要另立黨中央,國(guó)民黨出現(xiàn)五個(gè)太陽(yáng)

      諦聽骨語(yǔ)本尊
      2026-03-20 19:18:59
      與特朗普聊完了,高市笑容已消失,美國(guó)通告日本:中方反制還沒完

      與特朗普聊完了,高市笑容已消失,美國(guó)通告日本:中方反制還沒完

      影孖看世界
      2026-03-20 17:14:55
      投資147億!北京兩大高速改擴(kuò)建啟動(dòng),預(yù)計(jì)2028—2029年陸續(xù)建成

      投資147億!北京兩大高速改擴(kuò)建啟動(dòng),預(yù)計(jì)2028—2029年陸續(xù)建成

      石辰搞笑日常
      2026-03-21 14:08:41
      美媒總算看明白:中國(guó)這哪是買石油,分明是在給俄進(jìn)行“大換血”

      美媒總算看明白:中國(guó)這哪是買石油,分明是在給俄進(jìn)行“大換血”

      墨印齋
      2026-01-02 20:47:40
      地球上真的缺油嗎?實(shí)際上是多得用不完

      地球上真的缺油嗎?實(shí)際上是多得用不完

      比利
      2026-03-18 21:40:05
      NBA|掘金逆轉(zhuǎn)擒龍,約基奇準(zhǔn)三雙、哈達(dá)威7記三分

      NBA|掘金逆轉(zhuǎn)擒龍,約基奇準(zhǔn)三雙、哈達(dá)威7記三分

      北青網(wǎng)-北京青年報(bào)
      2026-03-21 12:49:03
      小貓葫蘆娃?7只病貓集體掛水,老父親挨個(gè)點(diǎn)名:葫蘆咪~

      小貓葫蘆娃?7只病貓集體掛水,老父親挨個(gè)點(diǎn)名:葫蘆咪~

      拜見喵主子
      2026-03-21 12:23:45
      沈騰老婆原諒馬麗了!?

      沈騰老婆原諒馬麗了!?

      八卦瘋叔
      2026-03-21 11:43:24
      繼“南極人”之后,這三個(gè)品牌也賣起了吊牌,你買的可能都是假貨

      繼“南極人”之后,這三個(gè)品牌也賣起了吊牌,你買的可能都是假貨

      春秋硯
      2026-03-20 14:25:06
      1989年哈梅內(nèi)伊在北京吃烤鴨時(shí),一張罕見留影,此后再未踏出國(guó)門

      1989年哈梅內(nèi)伊在北京吃烤鴨時(shí),一張罕見留影,此后再未踏出國(guó)門

      動(dòng)物奇奇怪怪
      2026-03-07 01:52:57
      5000磅鉆地彈砸下去還不夠,伊朗打出自殺式防御,美國(guó)卻先內(nèi)耗了

      5000磅鉆地彈砸下去還不夠,伊朗打出自殺式防御,美國(guó)卻先內(nèi)耗了

      輝輝歷史記
      2026-03-21 13:26:38
      回大陸后我才敢說:真正的香港,和網(wǎng)上說的根本不是一回事

      回大陸后我才敢說:真正的香港,和網(wǎng)上說的根本不是一回事

      番外行
      2026-03-20 13:10:58
      西方突然意識(shí)到“不對(duì)勁”:中東戰(zhàn)爭(zhēng)打得越久,就越對(duì)中國(guó)有好處

      西方突然意識(shí)到“不對(duì)勁”:中東戰(zhàn)爭(zhēng)打得越久,就越對(duì)中國(guó)有好處

      漫步獨(dú)行俠
      2026-03-20 08:54:11
      突發(fā)!伊朗導(dǎo)彈擊中印度洋英軍基地,西方震驚!韓國(guó)加入六國(guó)聯(lián)軍

      突發(fā)!伊朗導(dǎo)彈擊中印度洋英軍基地,西方震驚!韓國(guó)加入六國(guó)聯(lián)軍

      影像溫度
      2026-03-21 11:31:11
      法國(guó)、英國(guó)、德國(guó)、意大利、荷蘭、日本發(fā)表聯(lián)合聲明:準(zhǔn)備采取措施保障霍爾木茲海峽安全

      法國(guó)、英國(guó)、德國(guó)、意大利、荷蘭、日本發(fā)表聯(lián)合聲明:準(zhǔn)備采取措施保障霍爾木茲海峽安全

      新民周刊
      2026-03-20 13:05:42
      吉利“偷襲”比亞迪

      吉利“偷襲”比亞迪

      藍(lán)莓財(cái)經(jīng)
      2026-03-20 17:17:55
      我在安徽這個(gè)小縣城待了半個(gè)月,不想走了!這里藏著真正的生活

      我在安徽這個(gè)小縣城待了半個(gè)月,不想走了!這里藏著真正的生活

      夏末moent
      2026-03-21 10:01:19
      2026-03-21 15:32:49
      Excel從零到一 incentive-icons
      Excel從零到一
      0基礎(chǔ),0成本學(xué)習(xí)Excel
      580文章數(shù) 87199關(guān)注度
      往期回顧 全部

      科技要聞

      宇樹招股書拆解,人形機(jī)器人出貨量第一!

      頭條要聞

      女子花20萬(wàn)元租下老宅20年 一家三口從城市搬進(jìn)鄉(xiāng)村住

      頭條要聞

      女子花20萬(wàn)元租下老宅20年 一家三口從城市搬進(jìn)鄉(xiāng)村住

      體育要聞

      誰(shuí)在決定字母哥未來?

      娛樂要聞

      CMG盛典獲獎(jiǎng)名單:章子怡高葉同獲影后

      財(cái)經(jīng)要聞

      通脹警報(bào)拉響,加息潮要來了?

      汽車要聞

      小鵬汽車2025年Q4盈利凈賺3.8億 全年?duì)I收767億

      態(tài)度原創(chuàng)

      教育
      親子
      數(shù)碼
      房產(chǎn)
      公開課

      教育要聞

      成了孤兒!隨州一中勵(lì)志標(biāo)語(yǔ)很任性,為了高考六親不認(rèn)至于嗎

      親子要聞

      閨女一直都很尊重她爸的意見啊!

      數(shù)碼要聞

      解碼智慧臥室范式新品發(fā)布:慕思成為全屋智能“睡眠中樞”

      房產(chǎn)要聞

      全城狂送1000杯咖啡!網(wǎng)易房產(chǎn)【早C計(jì)劃】,即刻啟動(dòng)!

      公開課

      李玫瑾:為什么性格比能力更重要?

      無障礙瀏覽 進(jìn)入關(guān)懷版