arogachev / yii2-excel

ActiveRecord import and export based on PHPExcel for Yii 2 framework
Other
64 stars 25 forks source link

cell "A1". Attribute not exist. #28

Open wangdaguo opened 8 years ago

wangdaguo commented 8 years ago

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

1Luc1 commented 7 years ago

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 countryid.

my excel looks like this

unbenannt

So whats the problem here?

1Luc1 commented 7 years ago

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,

        ],
    ],
]);