[英]read an excel sheet which have multiple sheets and without table
I have an excel sheet which contain 10 sheets and saved inside SharePoint document library.我有一个 excel 工作表,其中包含 10 个工作表并保存在 SharePoint 文档库中。 and i want to do the following:-
我想做以下事情:-
So how i can read this excel sheet rows?那么我如何阅读这个 excel 表行? here is a screen shot of the excel sheet:-
这是 excel 表的屏幕截图:-
Thanks谢谢
I'm going to give you a fairly generic answer but you can take it from there and it will give you a result.我会给你一个相当通用的答案,但你可以从那里得到它,它会给你一个结果。
You can use the Run script
action in the Excel online connector(s).您可以在 Excel 在线连接器中使用
Run script
操作。 It allows you to write a script using the Office Scripts
framework which composes of a set of typescript classes, etc. that allows you to work with Excel workbooks stored in SharePoint or OneDrive.它允许您使用
Office Scripts
框架编写脚本,该框架由一组 typescript 类等组成,允许您使用存储在 SharePoint 或 OneDrive 中的 Excel 个工作簿。
It' like VBA but for the web. However, it's not as complete as VBA, but, it does near on everything you'd ever need and that which isn't catered for can be achieved via alternative means.它类似于 VBA,但对于 web。然而,它不像 VBA 那样完整,但是,它确实满足了您所需要的一切,并且可以通过其他方式实现无法满足的需求。
This is the script I put together, it's basic but gives you all of the data.这是我放在一起的脚本,它很基本,但为您提供了所有数据。 You'd need to do the work to enhance it and make it more useful for you.
您需要做一些工作来增强它并使其对您更有用。
function main(workbook: ExcelScript.Workbook, worksheetName: string) {
let worksheet = workbook.getWorksheet(worksheetName);
return worksheet.getUsedRange().getValues();
}
If you need to know how to create a script, follow these links and please note, for absolute ease, use the excel web client to create the script, the desktop version is around but don't complicate it for yourself and go through the web, it's tried and tested...如果您需要知道如何创建脚本,请点击这些链接,请注意,为了绝对简单,请使用 excel web 客户端创建脚本,桌面版本可用但不要让自己复杂化,go 通过 web ,它已经过试验和测试......
https://learn.microsoft.com/en-us/office/dev/scripts/overview/excel https://learn.microsoft.com/en-us/office/dev/scripts/overview/excel
https://support.microsoft.com/en-us/office/introduction-to-office-scripts-in-excel-9fbe283d-adb8-4f13-a75b-a81c6baf163a https://support.microsoft.com/en-us/office/introduction-to-office-scripts-in-excel-9fbe283d-adb8-4f13-a75b-a81c6baf163a
For the worksheet I ran the script over, this was the resulting JSON. It's a 2 dimensional array by rows and columns of data...对于我运行脚本的工作表,结果是 JSON。它是一个由数据行和列组成的二维数组...
[
[
"Date",
"Time",
"g/l ni",
"ECV808Ha",
"Multiple"
],
[
44698.64584,
44698.64584,
4,
5,
20
],
[
44698.64928,
44698.64928,
5,
15,
75
],
[
44698.65506,
44698.65506,
5.2,
4.8,
24.96
],
[
44698.66566,
44698.66566,
4,
45,
180
],
[
44699.63499,
44699.63499,
8.6,
9.3,
79.98
],
[
44699.63914,
44699.63914,
15.2,
8.2,
124.64
],
[
44699.64223,
44699.64223,
14.2,
18.6,
264.12
],
[
44699.6455,
44699.6455,
8.2,
2.6,
21.32
],
[
44699.65178,
44699.65178,
15,
15.2,
228
],
[
44699.66725,
44699.66725,
14,
12.2,
170.8
],
[
44699.67292,
44699.67292,
15,
16,
240
],
[
44699.67413,
44699.67413,
12.2,
13.4,
163.48
],
[
44700.50296,
44700.50296,
4,
2.5,
10
],
[
44700.50534,
44700.50534,
5,
8,
40
],
[
44700.52765,
44700.52765,
4.5,
8.6,
38.7
],
[
44700.52861,
44700.52861,
8.5,
4.2,
35.7
],
[
44700.5975,
44700.5975,
8,
14,
112
],
[
44700.60117,
44700.60117,
4,
8,
32
],
[
44700.60197,
44700.60197,
4,
2.5,
10
],
[
44700.60348,
44700.60348,
4.5,
5.25,
23.625
],
[
44700.60414,
44700.60414,
80,
2.5,
200
],
[
44700.60597,
44700.60597,
4,
2.5,
10
],
[
44700.61531,
44700.61531,
8,
6,
48
],
[
44700.645,
44700.645,
4,
2.5,
10
],
[
44700.64679,
44700.64679,
4,
4.5,
18
],
[
44700.6484,
44700.6484,
8,
6.2,
49.6
],
[
44700.64964,
44700.64964,
6,
6,
36
],
[
44701.38266,
44701.38266,
4,
5,
20
],
[
44701.40955,
44701.40955,
5,
5.5,
27.5
],
[
44701.41484,
44701.41484,
8,
6,
48
],
[
44701.41723,
44701.41723,
8,
65,
520
],
[
44701.42251,
44701.42251,
4,
6,
24
],
[
44701.42304,
44701.42304,
4,
8,
32
],
[
44701.42365,
44701.42365,
8,
90,
720
],
[
44701.42384,
44701.42384,
8,
60,
480
],
[
44701.42045,
44701.42045,
4,
5,
20
],
[
44701.43058,
44701.43058,
18,
16,
288
],
[
44704.3115,
44704.3115,
4,
8,
32
],
[
44704.43532,
44704.43532,
6,
525,
3150
],
[
44704.44973,
44704.44973,
5,
6,
30
]
]
... If you write your own script, you can return specific JSON structures that suit your requirement. ... 如果您编写自己的脚本,则可以返回适合您要求的特定 JSON 结构。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.