質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

Q&A

解決済

1回答

3216閲覧

xlsファイルへの書き出し時のエラー

mote

総合スコア128

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

0グッド

2クリップ

投稿2019/04/17 05:15

以下のような関数を挿入したいのですが,

js

1function exe(box){ 2 const XlsxPopulate = require('xlsx-populate') 3 XlsxPopulate.fromFileAsync("./r-rec.xls").then((book) => { 4 const sheet1 = book.sheet("Sheet1") 5 sheet1.cell("A4").value(100) 6 sheet1.cell("A5").value(200) 7 sheet1.cell("A6").value(300) 8 book.toFileAsync("./r-rec.xls") 9 }) 10 let a = box.num ; 11 console.log("exeから :" + a) ; 12 }

の部分で,
node:15772) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'children' of null
at Object.findChild (/Users/motegiyuta/node_modules/xlsx-populate/lib/xmlq.js:44:28)
at StyleSheet._init (/Users/motegiyuta/node_modules/xlsx-populate/lib/StyleSheet.js:203:34)
at new StyleSheet (/Users/motegiyuta/node_modules/xlsx-populate/lib/StyleSheet.js:59:14)

at externals.Promise.resolve.then.then.then.then.then.nodes (/Users/motegiyuta/node_modules/xlsx-populate/lib/Wor

kbook.js:612:36)
at <anonymous>
(node:15772) 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(). (re
jection id: 1)
(node:15772) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise reject
ions that are not handled will terminate the Node.js process with a non-zero exit code.
のようなエラーが出てしまいます.

プロミスは使っていないのですが,よろしくお願いいたします

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

karamarimo

2019/04/17 18:03

xlsx-populate は xls ファイルに対応していますか?こちらで調べた範囲では対応しているとは書いていなかったので対応していない可能性があります。
mote

2019/04/24 03:45

xlsxファイルに変換したらできました. ご指示の通りでした ありがとうございました
guest

回答1

0

自己解決

ファイルの拡張子の違いによる,対応,非対応の違い.
xlsxファイルにのみモジュールが対応していた.

投稿2019/04/24 03:46

mote

総合スコア128

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問