butlerx / gatsby-source-google-spreadsheets

A source plugin for Gatsby that allows reading data from Google Sheets.
MIT License
39 stars 10 forks source link

Column with phone number with infix '-' converts to 'number' #36

Open febeling opened 12 months ago

febeling commented 12 months ago

Describe the bug When a column contains only phone numbers with (in Germany) charactaristic infix '-' (minus sign) for formatting, then the column is inferred to be 'number'. On the subsequent parsing of the value an error occurs, 'GraphQLError: Float cannot represent non numeric value: NaN'

To Reproduce Steps to reproduce the behavior:

  1. Add a sheet with a column ('phone')
  2. Add a phone number ('0177-420420')
  3. Start a gatsby project with gatsby-source-google-spreadsheets plugin configured
  4. Wait for the sheet to load and process
  5. See error

Expected behavior The column should be read as 'string'

Screenshots n/a

Desktop (please complete the following information):

febeling commented 12 months ago

Excerpt from the log output from npm run build showing this error. Just to further illustrate the issue.

12:52:37 PM: error There was an error in your GraphQL query:
12:52:37 PM: Float cannot represent non numeric value: NaN
12:52:37 PM:   24 |     }
12:52:37 PM:   25 |   }
12:52:37 PM:   26 |   groups: allGoogleGroupsSheet(filter: {active: {eq: true}}) {
12:52:37 PM:   27 |     nodes {
12:52:37 PM:   28 |       id
12:52:37 PM:   29 |       active
12:52:37 PM:   30 |       name
12:52:37 PM:   31 |       address
12:52:37 PM: > 34 |       phone
12:52:37 PM:      |       ^
12:52:37 PM:   36 |       time
12:52:37 PM:   37 |     }
12:52:37 PM:   38 |   }
12:52:37 PM:   39 | }
12:52:37 PM: File path: /opt/build/repo/src/pages/index.tsx
febeling commented 12 months ago
Sheet content: active name address phone
TRUE Arijana 0177-420420