Author Topic: Import xslx spreadsheet  (Read 3146 times)

kshipra

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 94
    • View Profile
Import xslx spreadsheet
« on: November 27, 2018, 06:02:23 pm »
I have requirement to upload data from excel sheet with varying columns into database.

I can think of 2 options:

1. Upload csv files and parse it.

2. I am thinking of using import xslx option. I can import any excel file in web UI. I was wondering
    * how can I validate the excel sheet on client side to make sure there are certain required columns ?
    * how can i send this data to server? 
      would grid.getData(); work?  Is there any better option?



paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6314
    • View Profile
Re: Import xslx spreadsheet
« Reply #1 on: November 28, 2018, 01:09:52 pm »
That depends upon how you identify the required columns. Excel spreadsheet doesn't have concept of dataIndx of fields.

You can persist the spreadsheet data by either exporting it to js workbook or exporting it to Excel xlsx file.

It has the benefit of preserving the formulas, merge cells which are lost if converted into another format like json, csv.
« Last Edit: November 28, 2018, 01:28:01 pm by paramquery »

kshipra

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 94
    • View Profile
Re: Import xslx spreadsheet
« Reply #2 on: November 28, 2018, 04:55:24 pm »
I am trying to understand import functionality. So if pqgrid on import does not get initialized and its methods and options will not work on imported excel sheet then why would we want to use import ?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6314
    • View Profile
Re: Import xslx spreadsheet
« Reply #3 on: November 28, 2018, 05:49:49 pm »
Of course pqgrid is initialized and its API works on imported Excel sheet. I didn't say that, did I? :)

Yes you can use grid.getData() method to get data in grid and check 1st or nth row to check presence of certain columns in your spreadsheet.

This is the demo of import from Excel: https://paramquery.com/pro/demos/import-xlsx
« Last Edit: November 28, 2018, 06:02:14 pm by paramquery »

kshipra

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 94
    • View Profile
Re: Import xslx spreadsheet
« Reply #4 on: December 07, 2018, 01:24:20 pm »
Can import of csv be also supported ? it does not work currently.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6314
    • View Profile
Re: Import xslx spreadsheet
« Reply #5 on: December 10, 2018, 11:59:44 am »
Import of csv is not related to import of xlsx and is not available currently.