可以通过API批量替换Excel文件中的字符串吗?

huangapple go评论71阅读模式
英文:

Is it possible to bulk replace strings in an Excel file via API?

问题

能够通过 Microsoft Graph API 批量替换 Excel 文件中的字符串吗?如果不行,是否有其他方法可以实现这个功能?感谢您的提前帮助。

英文:

Is it possible to bulk replace strings in an Excel file via API?

Hello, I am aware that Google Sheets has an API called "FindReplaceRequest" (https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#findreplacerequest)
which can be used to replace values in a spreadsheet with any desired string.

I am interested in achieving the same functionality in Microsoft Excel. I have come across the Microsoft Graph API (https://learn.microsoft.com/en-us/graph/overview)
but I am not sure if this API can be used or if there are other methods available to achieve this.

Could you please advise if it is possible to replace strings in an Excel file via Microsoft Graph API?
If not, how can I do that with any other methods?

I would greatly appreciate any insights as I am not very familiar with Microsoft services, thank you in advance.

答案1

得分: 1

You can use Microsoft Graph to invoke any workbook function.

Check list of supported functions.

Example for replace function:

POST https://graph.microsoft.com/beta/me/drive/root:/path/to/file/fileName.xlsx:/workbook/functions/replace
content-type: Application/Json
authorization: Bearer {access-token}
workbook-session-id: {session-id}

{
"oldText": "old text",
"startNum": 0,
"numChars": 8,
"newText": "new text"
}

英文:

You can use Microsoft Graph to invoke any workbook function.

Check list of supported functions.

Example for replace function

POST https://graph.microsoft.com/beta/me/drive/root:/path/to/file/fileName.xlsx:/workbook/functions/replace
content-type: Application/Json 
authorization: Bearer {access-token} 
workbook-session-id: {session-id}

{
    "oldText": "old text",
    "startNum": 0,
    "numChars": 8,
    "newText": "new text"
}

huangapple
  • 本文由 发表于 2023年5月10日 13:21:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/76215131.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定