我正在编写这个软件包,用于在Electron Python框架中开发一个以Excel电子表格为数据库的应用程序 我在错误下面
**(node:14796) UnhandledPromiseRejectionWarning: RangeError: Invalid string length
at ..\node_modules\database-js-xlsx\index.js:507:63
(Use `node --trace-warnings ...` to show where the warning was created)
(node:14796) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:14796) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.**
当我尝试点击节点--unhandledRejections=strict.js时
**..\node_modules\database-js-xlsx\index.js:507
sql = sql.substr(0, err.offset) + '.' + sql.substr(err.offset + 1);
^
RangeError: Invalid string length**
有人能帮我吗
下面是我的代码
**var database = require('database-js-xlsx/index');
var connection = database.open({ Database: 'yields.xlsx' });
function handleError(error) {
console.log("ERROR:", error);
process.exit(1);
}
connection.query("SELECT a,b FROM Sheet1$A1:C4 Where c= 'Apples' ").then((data) => {
console.log(data[0].a)
if (data.length != 1) {
handleError(new Error("Invalid data returned"));
}
else{
console.log(data)
}
connection.close().then(() => {
process.exit(0);
}).catch(handleError);
}).catch(handleError);**
提前谢谢
您似乎正在查询单元格而不是工作表
试试
SELECT a,b FROM Sheet1 Where c= 'Apples'
此外,我得到的印象是,专栏应该命名,而不是地址
因此,如果a、b、c是您的列名,我希望它们被标记在您的第一行。这件事我不确定
相关问题 更多 >
编程相关推荐