@@ -81,7 +81,7 @@ func (gs *GoogleSheets) GetSpreadsheets(ctx context.Context, config models.Datas
81
81
return nil , err
82
82
}
83
83
84
- fileNames := map [string ]string {}
84
+ fileNames := make ( map [string ]string , len ( files ))
85
85
for _ , i := range files {
86
86
fileNames [i .Id ] = i .Name
87
87
}
@@ -180,16 +180,18 @@ func (gs *GoogleSheets) transformSheetToDataFrame(sheet *sheets.GridData, meta m
180
180
if column .HasMixedTypes () {
181
181
warning := fmt .Sprintf ("Multiple data types found in column %q. Using string data type" , column .Header )
182
182
warnings = append (warnings , warning )
183
- log .DefaultLogger .Warn (warning )
183
+ log .DefaultLogger .Debug (warning )
184
184
}
185
185
186
186
if column .HasMixedUnits () {
187
187
warning := fmt .Sprintf ("Multiple units found in column %q. Formatted value will be used" , column .Header )
188
188
warnings = append (warnings , warning )
189
- log .DefaultLogger .Warn (warning )
189
+ log .DefaultLogger .Debug (warning )
190
190
}
191
191
}
192
192
193
+ // We want to show the warnings only once per column
194
+ warningsIncludeConverterErrorForColumns := make (map [int ]bool , len (columns ))
193
195
for rowIndex := start ; rowIndex < len (sheet .RowData ); rowIndex ++ {
194
196
for columnIndex , cellData := range sheet .RowData [rowIndex ].Values {
195
197
if columnIndex >= len (columns ) {
@@ -202,8 +204,10 @@ func (gs *GoogleSheets) transformSheetToDataFrame(sheet *sheets.GridData, meta m
202
204
}
203
205
204
206
err := inputConverter .Set (columnIndex , rowIndex - start , cellData )
205
- if err != nil {
207
+ if err != nil && ! warningsIncludeConverterErrorForColumns [columnIndex ] {
208
+ log .DefaultLogger .Debug ("unsuccessful converting of cell data" , "err" , err )
206
209
warnings = append (warnings , err .Error ())
210
+ warningsIncludeConverterErrorForColumns [columnIndex ] = true
207
211
}
208
212
}
209
213
}
@@ -212,7 +216,6 @@ func (gs *GoogleSheets) transformSheetToDataFrame(sheet *sheets.GridData, meta m
212
216
meta ["spreadsheetId" ] = qm .Spreadsheet
213
217
meta ["range" ] = qm .Range
214
218
frame .Meta = & data.FrameMeta {Custom : meta }
215
- log .DefaultLogger .Debug ("frame.Meta: %s" , spew .Sdump (frame .Meta ))
216
219
return frame , nil
217
220
}
218
221
@@ -287,13 +290,13 @@ func getUniqueColumnName(formattedName string, columnIndex int, columns map[stri
287
290
}
288
291
289
292
func getColumnDefinitions (rows []* sheets.RowData ) ([]* ColumnDefinition , int ) {
290
- columns := []* ColumnDefinition {}
291
- columnMap := map [string ]bool {}
292
293
if len (rows ) < 1 {
293
- return columns , 0
294
+ return [] * ColumnDefinition {} , 0
294
295
}
295
296
headerRow := rows [0 ].Values
296
297
298
+ columns := make ([]* ColumnDefinition , 0 , len (headerRow ))
299
+ columnMap := make (map [string ]bool , len (headerRow ))
297
300
start := 0
298
301
if len (rows ) > 1 {
299
302
start = 1
0 commit comments