[英]Writing to online excel from front-end
I have a form with several fields (written in React).我有一个包含多个字段的表单(用 React 编写)。
By submitting the form, I want the values will be written to an existing Excel file (the Excel file is saved in OneDrive), ie each submit will add 1 row to the Excel sheet.通过提交表单,我希望将值写入现有的 Excel 文件(Excel 文件保存在 OneDrive 中),即每次提交都会在 ZC1D81AF5835844B4E9D936910DED8 表中添加 1 行。
How can I do it?我该怎么做?
You can use the Excel REST API to do this.您可以使用Excel REST API来执行此操作。
To add a row, first identify the endpoint for your Excel file, and send a POST request to a URL like要添加一行,首先确定 Excel 文件的端点,然后向 URL 发送 POST 请求,例如
https://graph.microsoft.com/v1.0/me/drive/root:/{sheet-name}:/workbook/tables/Table1/rows/add
with a payload similar to:有效载荷类似于:
{
'index': null,
'values': [
['col-1-value', 'col-2-value', ...]
]
}
Where index
signifies the offset from the last created row.其中
index
表示与最后创建的行的偏移量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.