• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Validating contents of a table imported from MS Excel

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using jQuery/javascript to read in data from a spreadsheet using "xlsx.full.min.js" placing the data into a table and then validating the contents. Column 4 must be an unsigned integer, so I am using "RegExp("^\d+$")" to test for this. It always returns false even when a number is entered into the column in the spreadsheet that is imported.

Another issue is that the dates I enter are dd/mm/yyyy (e.g., 02/12/2018). However, the imported date is m/d/yy (e.g., 12/2/18).

The code is at: https://jsfiddle.net/Glyndwr/6z1ckv8y/2/

Sample input would be: "Paranoid", "Marvin", "01/09/1978", "42", "01/12/2018"
 
Bartender
Posts: 5902
57
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you writing this in Javascript or Java? They are two completely different languages. And The Ranch has a different forum for posting Javascript questions.

If it is really Java then most people seem to use Apache's "POI" library to read and write Excel files.
 
Glyndwr Bartlett
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Carey,

My apologies I could not find the javascript forum. Can I transfer this or do I close it and create a new topic?

Kind regards,

Glyn
 
Marshal
Posts: 24594
55
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Glyndwr Bartlett wrote:Another issue is that the dates I enter are dd/mm/yyyy (e.g., 02/12/2018). However, the imported date is m/d/yy (e.g., 12/2/18).



From what I know about Excel I recall that it will take anything that looks like a date and store it in its own internal format. It won't remember what format you used when you entered it.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!