sheet.getData is not a function
时间: 2024-01-10 15:02:14 浏览: 64
I apologize for the confusion. It seems that the `getData` method I mentioned earlier does not exist in SpreadJS. However, you can still retrieve the data from the sheet using different approaches. Here are a few alternatives:
1. Using `getValues` method:
```javascript
var sheet = spread.getActiveSheet();
var data = sheet.getValues();
console.log(data);
```
2. Using `getDataSource` method:
```javascript
var sheet = spread.getActiveSheet();
var data = sheet.getDataSource();
console.log(data);
```
3. Iterating through cells to retrieve values:
```javascript
var sheet = spread.getActiveSheet();
var data = [];
var rowCount = sheet.getRowCount();
var colCount = sheet.getColumnCount();
for (var i = 0; i < rowCount; i++) {
var row = [];
for (var j = 0; j < colCount; j++) {
var cell = sheet.getCell(i, j);
var cellValue = cell.value();
row.push(cellValue);
}
data.push(row);
}
console.log(data);
```
Please try these alternatives and let me know if you encounter any further issues.
阅读全文