let sheets = Application.ActiveWorkbook.Sheets;
sheets = Application.Sheets;
// 打印所有工作表的名称
for (let i = 1; i <= sheets.Count; i++) {
Application.Sheets.Item(i).Activate();
console.log(`工作表
名称 为:${sheets.Item(i).Name},
ID 为:${sheets.Item(i).Id},
Index 为:${sheets.Item(i).Index},
Type 为:${sheets.Item(i).Type}
`);
console.log(Application.Sheets.Item(i).UsedRange);//第一种方法,智能表格的脚本
}
console.log(Application.Record.GetRecords({ SheetId: 1 }));//第二种方法,多维表的脚本
上面两种方法都获取不到数据 多维表的方法直接报错 TypeError:Cannot read properties of undefined (reading 'GetRecords')