構造を処理することは困難です。 Excelファイルを管理している場合は、読み込みが容易なもの(QVだけでなく)に変更することをお勧めします。
以下のスクリプトはデータを読み込んで、はるかに簡単にチャートを作成するために使用されます。また、使用したqvwをダウンロードすることもできます。here
P.S.私は、コードを実行するとイムは、QVバージョン12.1
// Load only the first record to get the available column names
Metadata:
First 1
Load
*
From
[C:\Users\Home\Documents\Book1.xlsx] (ooxml, embedded labels, table is Sheet1)
;
// Get the total column names - 1 (will exclude the Day column
let sColumnsCount = NoOfFields('Metadata') - 1;
// How many iterations. 5 is the step
let sStep = $(sColumnsCount)/5;
for i = 0 to $(sColumnsCount) - 1 step 5
// Get the column names for each iteration
let sDay = FieldName(1, 'Metadata');
let sLocationField = FieldName($(i) + 2, 'Metadata');
let sSmallPlaceField = FieldName($(i) + 3, 'Metadata');
let sBigPlaceField = FieldName($(i) + 4, 'Metadata');
let sAllField = FieldName($(i) + 5, 'Metadata');
let sDateField = FieldName($(i) + 6, 'Metadata');
// Load only the colums from the iteration
// and append it to the main table
Data:
Load
$(sDay) as Day,
$(sLocationField) as Location,
$(sSmallPlaceField) as SmallPlace,
$(sBigPlaceField) as BigPlace,
//$(sAllField) as All, // <-- Dont think you need this
$(sDateField) as Date
FROM
[C:\Users\Home\Documents\Book1.xlsx] (ooxml, embedded labels, table is Sheet1)
Where
lower($(sLocationField)) <> 'total' // <-- think that the Total values are not needed as well
;
next
Drop Table Metadata;
を使用して、私得たエラー:構文エラー、不足しているFROM /紛失: データ:デイとして ロード 日、場所など SmallPlace1、SmallPlaceとして BigPlace1、 ALL1 [:\ユーザーはLoc.xlsx \ C](OOXML、埋め込まれたラベルを、表がシート1である) 下(SmallPlace1)<> 'の合計は、' それはのように見えます BigPlace、 すべてのように日付1、 FROM日 のように変数sLocationFieldの値をm SmallPlace1 ????そしてデータは、手順5を入れて、なぜ私は理解していない – dev
空のですか?このステップ5は何を意味しますか? – dev
私はスクリーンショットの1つのフォームと同じエクセルを作り直そうとしました。おそらく、私は何かを見逃したかもしれません。サンプルデータをどこかにアップロードすることができれば、それを調べることができます。 –