yii2-excel icon indicating copy to clipboard operation
yii2-excel copied to clipboard

cell "A1". Attribute not exist.

Open wangdaguo opened this issue 8 years ago • 2 comments

Error when preparing data for import: sheet "data", cell "A1". Attribute not exist.

wangdaguo avatar Mar 10 '16 02:03 wangdaguo

i also got the error: Error when preparing data for import: sheet "Tabelle1", cell "A1". Attribute not exist.

i have an model person with the attributes: id, forename, surname, birthday and country_id.

my excel looks like this

unbenannt

So whats the problem here?

1Luc1 avatar Aug 15 '17 17:08 1Luc1

ok i found the "problem". by default the standardModelsConfig useAttributeLabels is set to true. So i changed this, since i have different labels; and now it works

$importer = new Importer([
    'filePath' => Yii::getAlias('@frontend/test.xlsx'),
    'standardModelsConfig' => [
        [
            'className' => Person::className(),
            'useAttributeLabels' => false,

        ],
    ],
]);

1Luc1 avatar Aug 15 '17 17:08 1Luc1