简体   繁体   English

阅读一张 excel 表格,其中有多个表格且没有表格

[英]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:-我想做以下事情:-

  1. read the data of a single sheet named "CompnayInfo", the sheet contain the first row as headers and have filters but the sheet does not have table.读取名为“CompnayInfo”的单个工作表的数据,该工作表包含第一行作为标题并具有过滤器,但该工作表没有表格。

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.

相关问题 从Windows Store应用程序中阅读Microsoft Excel工作表 - Read Microsoft Excel Sheets from a Windows Store Application 如何使用 python 删除 SharePoint excel 工作表中存在的所有行? - How to delete all the rows present in SharePoint excel sheet table using python? 我可以读取上传的 excel 工作表文件并遍历其项目以更新我们 SPFx 中的 SharePoint 网站栏选择吗 - Can i read uploaded excel sheet file and loop through its items to update a SharePoint site column choices inside our SPFx Excel Power Query - 通过位于 Sharepoint 上的 Excel 表刷新 - Excel Power Query - Refresh via Excel sheet located on Sharepoint 是否可以从在线存储在SharePoint上的Excel工作表中提取数据? - Is it possible to pull data from an excel sheet stored on sharepoint online? 如何在 C# 中读取 SharePoint 在线文档中存在的 excel 文件,然后我必须加密一些列,最后将其写入 Snowflake 数据库? - How to read an excel file present in SharePoint online document in C#, then I have to encrypt some columns and finally write it to Snowflake database? 使用 MS Graph 通过 Sharepoint 读取 Excel 内容 - Using MS Graph to Read Excel Contents Through Sharepoint SharePoint-Excel Online-在Excel中编辑和在浏览器中编辑多个用户 - SharePoint - Excel Online - Edit in Excel and Edit in Browser multiple users 构建一个 SPFX Web 部件,它呈现一个 HTML 框,其中具有可配置的标题、描述和可点击按钮 - Build an SPFX web part which render an HTML BOX which have a configurable Title, Description and Clickable Button 无法读取标题中有空格的 Sharepoint 列表项 - Not able to read Sharepoint list items which has blanks in its headers
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM