国产av一二三区|日本不卡动作网站|黄色天天久久影片|99草成人免费在线视频|AV三级片成人电影在线|成年人aV不卡免费播放|日韩无码成人一级片视频|人人看人人玩开心色AV|人妻系列在线观看|亚洲av无码一区二区三区在线播放

網(wǎng)易首頁(yè) > 網(wǎng)易號(hào) > 正文 申請(qǐng)入駐

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

0
分享至

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

一、使用方法

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

首先我們需要先選中對(duì)應(yīng)的數(shù)據(jù)區(qū)域,然后在上方點(diǎn)擊Deepseek,最后會(huì)跳出窗口,在窗口中提出問(wèn)題,等待一段時(shí)間后就能得到對(duì)應(yīng)的結(jié)果了,下面來(lái)看下如何構(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)輸入您的問(wèn)題(選中的單元格內(nèi)容將作為處理數(shù)據(jù)):", "DeepSeek 提問(wèn)")
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
' 組合問(wèn)題和單元格內(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)
' 寫(xiě)入右側(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)輸入您的問(wèn)題(選中的單元格內(nèi)容將作為處理數(shù)據(jù)):", "DeepSeek 提問(wèn)") 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 ' 組合問(wèn)題和單元格內(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) ' 寫(xiě)入右側(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)擊【開(kāi)發(fā)工具】然后點(diǎn)擊【Visiual Basic】進(jìn)入編輯窗口,在右側(cè)空白區(qū)域點(diǎn)擊鼠標(biāo)右鍵找到插入,找到【模塊】,然后在右側(cè)的窗口那里直接粘貼即可

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

四、制作按鈕

需要在右側(cè)點(diǎn)擊文件,然后最下放找到【選項(xiàng)】來(lái)調(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ā)過(guò),大家可以搜一下

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)推薦
賠光2億后,冉瑩穎獨(dú)自搬家30箱未給鄒市明留體面

賠光2億后,冉瑩穎獨(dú)自搬家30箱未給鄒市明留體面

春之韻
2026-03-18 09:32:52
繼德國(guó)之后,英國(guó)也開(kāi)始貼出“中文標(biāo)語(yǔ)”?中國(guó)游客:不能夠接受

繼德國(guó)之后,英國(guó)也開(kāi)始貼出“中文標(biāo)語(yǔ)”?中國(guó)游客:不能夠接受

潮鹿逐夢(mèng)
2026-04-02 12:31:48
WTI原油期貨向下跌破90美元/桶

WTI原油期貨向下跌破90美元/桶

每日經(jīng)濟(jì)新聞
2026-04-22 08:18:13
辭職7個(gè)月后,宗馥莉終于出手,新布局曝光,原來(lái)宗慶后沒(méi)看錯(cuò)人

辭職7個(gè)月后,宗馥莉終于出手,新布局曝光,原來(lái)宗慶后沒(méi)看錯(cuò)人

原夢(mèng)叁生
2026-04-22 07:45:39
錢留下,人別來(lái)!西班牙主席對(duì)中國(guó)甩出一句話,全網(wǎng)炸鍋了

錢留下,人別來(lái)!西班牙主席對(duì)中國(guó)甩出一句話,全網(wǎng)炸鍋了

菁菁子衿
2026-04-21 10:11:50
彭老總臨終前,拒絕見(jiàn)毛主席和周總理,卻渴望見(jiàn)到他一面!

彭老總臨終前,拒絕見(jiàn)毛主席和周總理,卻渴望見(jiàn)到他一面!

老謝談史
2026-04-22 17:48:57
庫(kù)克小米熱搜是 P圖!羅永浩竟被 P成蘋(píng)果 CEO!

庫(kù)克小米熱搜是 P圖!羅永浩竟被 P成蘋(píng)果 CEO!

LOGO研究所
2026-04-22 18:04:22
沈醉晚年赴香港探親,小女孩問(wèn):你為何用竹簽刺江姐?他如何回答

沈醉晚年赴香港探親,小女孩問(wèn):你為何用竹簽刺江姐?他如何回答

浩渺青史
2026-04-19 17:44:00
無(wú)錫招商城,怎么這樣了?

無(wú)錫招商城,怎么這樣了?

無(wú)錫eTV全媒體
2026-04-22 10:40:50
姜文女兒曬孕肚!63歲姜文喜當(dāng)外公!小時(shí)候曾因美貌備受關(guān)注!

姜文女兒曬孕肚!63歲姜文喜當(dāng)外公!小時(shí)候曾因美貌備受關(guān)注!

明星私服穿搭daily
2026-04-22 12:40:09
郭冬臨現(xiàn)狀:住北京老房子,身形消瘦、臉頰凹陷,59歲無(wú)兒無(wú)女!

郭冬臨現(xiàn)狀:住北京老房子,身形消瘦、臉頰凹陷,59歲無(wú)兒無(wú)女!

往史過(guò)眼云煙
2026-04-20 09:55:43
以色列士兵在黎巴嫩砸毀耶穌雕像,引發(fā)眾怒

以色列士兵在黎巴嫩砸毀耶穌雕像,引發(fā)眾怒

觀察者網(wǎng)
2026-04-21 07:56:40
轟的一聲,日本傳來(lái)一聲巨大爆響,自衛(wèi)隊(duì)傷亡慘重,尸體橫倒豎臥

轟的一聲,日本傳來(lái)一聲巨大爆響,自衛(wèi)隊(duì)傷亡慘重,尸體橫倒豎臥

音樂(lè)時(shí)光的娛樂(lè)
2026-04-22 15:22:20
最新公布!受伊朗戰(zhàn)爭(zhēng)影響,3月,中國(guó)從海灣六國(guó)進(jìn)口原油下滑了25%?

最新公布!受伊朗戰(zhàn)爭(zhēng)影響,3月,中國(guó)從海灣六國(guó)進(jìn)口原油下滑了25%?

王爺說(shuō)圖表
2026-04-21 18:27:43
濟(jì)南一市場(chǎng)賣魚(yú)檔口多只老鼠啃食鮮魚(yú),市監(jiān)回應(yīng):已收到相關(guān)反映,正在處理當(dāng)中,涉事魚(yú)檔已關(guān)停,已對(duì)市場(chǎng)進(jìn)行消殺

濟(jì)南一市場(chǎng)賣魚(yú)檔口多只老鼠啃食鮮魚(yú),市監(jiān)回應(yīng):已收到相關(guān)反映,正在處理當(dāng)中,涉事魚(yú)檔已關(guān)停,已對(duì)市場(chǎng)進(jìn)行消殺

極目新聞
2026-04-22 11:09:00
國(guó)乒最后一根救命稻草也斷了,王皓這次真要被逼到絕路上了

國(guó)乒最后一根救命稻草也斷了,王皓這次真要被逼到絕路上了

林子說(shuō)事
2026-04-22 13:14:55
排面!樊振東和英偉達(dá)創(chuàng)始人黃仁勛切磋球技,后者15歲拿乒乓球季軍

排面!樊振東和英偉達(dá)創(chuàng)始人黃仁勛切磋球技,后者15歲拿乒乓球季軍

818體育
2026-04-22 11:59:46
上海3歲男童被虐死案一審宣判:施暴女友死緩,生母庭外哭求死刑

上海3歲男童被虐死案一審宣判:施暴女友死緩,生母庭外哭求死刑

聽(tīng)心堂
2026-04-21 10:41:48
影子調(diào)查|揭秘58同城維修“幽靈訂單”:強(qiáng)行生成訂單,截胡上門(mén)服務(wù)

影子調(diào)查|揭秘58同城維修“幽靈訂單”:強(qiáng)行生成訂單,截胡上門(mén)服務(wù)

澎湃新聞
2026-04-22 09:06:29
上海一出租房?jī)?nèi)垃圾堆積如山,男租客淡定躺垃圾堆里玩手機(jī),房東一招“沒(méi)收手機(jī)”,讓他連夜將房間打掃干凈

上海一出租房?jī)?nèi)垃圾堆積如山,男租客淡定躺垃圾堆里玩手機(jī),房東一招“沒(méi)收手機(jī)”,讓他連夜將房間打掃干凈

都市快報(bào)橙柿互動(dòng)
2026-04-22 14:01:48
2026-04-22 19:03:00
Excel從零到一 incentive-icons
Excel從零到一
0基礎(chǔ),0成本學(xué)習(xí)Excel
581文章數(shù) 87220關(guān)注度
往期回顧 全部

科技要聞

對(duì)話梅濤:沒(méi)有視頻底座,具身智能走不遠(yuǎn)

頭條要聞

三甲醫(yī)院科主任被舉報(bào)"巨額財(cái)產(chǎn)來(lái)源不明" 舉報(bào)人發(fā)聲

頭條要聞

三甲醫(yī)院科主任被舉報(bào)"巨額財(cái)產(chǎn)來(lái)源不明" 舉報(bào)人發(fā)聲

體育要聞

網(wǎng)易傳媒再度簽約法國(guó)隊(duì)和阿根廷隊(duì)

娛樂(lè)要聞

復(fù)婚無(wú)望!baby黃曉明陪小海綿零交流

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

伊朗拒絕出席 特朗普宣布延長(zhǎng)?;鹌谙?/h3>

汽車要聞

純電續(xù)航301km+激光雷達(dá) 宋Pro DM-i飛馳版9.99萬(wàn)起

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

房產(chǎn)
手機(jī)
時(shí)尚
公開(kāi)課
軍事航空

房產(chǎn)要聞

狂搶284輪!中海海口再拿重磅宅地!

手機(jī)要聞

小米澎湃OS 3 Beta版推送“龍蝦”智能體Xiaomi miclaw

初夏穿赫本的白褲子,清新又高級(jí)!

公開(kāi)課

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

軍事要聞

特朗普宣布延長(zhǎng)?;?伊朗表態(tài)

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