Author Topic: Updating Excel file from Grid  (Read 490 times)

pbassey

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 36
    • View Profile
Updating Excel file from Grid
« on: November 03, 2022, 06:36:12 pm »
Good morning. I am looking for an example of how to have an excel file used to load the grid (using importXl & importWb) be updated as updates in the cells are made.  I see other examples of this in your demos, but nothing that uses an excel file as the source.

Thank you...

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Updating Excel file from Grid
« Reply #1 on: November 03, 2022, 09:42:28 pm »
Its workflow is import xlsx file into grid -> edit data and styles in grid -> export as xlsx file

Examples:

https://paramquery.com/pro/demos/import_xlsx_tabs

https://paramquery.com/pro/demos/import-xlsx

pbassey

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Updating Excel file from Grid
« Reply #2 on: November 04, 2022, 06:52:19 pm »
Thank you for the reply, but your response describes the use of the Export function (this.exportExcel).  I was looking for an implementation where the data in the spreadsheet is updated back to the excel file in real time similar to this example:
https://paramquery.com/pro/demos/editing_instant

Is there an example where this can be accomplished by updating the original Excel file used to load the Grid??

Thanks,
Peter

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Updating Excel file from Grid
« Reply #3 on: November 06, 2022, 05:16:52 pm »
Same method can be used to update the originating Excel file on server by passing url parameter to it.

This method posts pq_data, pq_ext, pq_decode, pq_filename parameters to the server.

Server script can copy data from pq_data and base64 decode the data if pq_decode is true, save data in a file and replace the originating excel file with it.

Note that file based exports ( xlsx, html, json, csv ) don't support incremental or differential updates.
« Last Edit: November 06, 2022, 05:30:36 pm by paramvir »

pbassey

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Updating Excel file from Grid
« Reply #4 on: November 16, 2022, 02:59:37 am »
Can you please provide a bit more detail with regard the syntax for the parameters (pq_data, pq_ext, pq_decode, pq_filename).  I see these parameters mentioned in your API section, but there are no examples anywhere on how to use them.

I would like to integrate these functions into a grid that does instant editing (saving) of data to the excel source file.  This example below is exactly what I need to do except the update is going back to the input excel file:
https://paramquery.com/pro/demos/editing_instant

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Updating Excel file from Grid
« Reply #5 on: November 17, 2022, 06:56:54 am »
These parameters are posted to and are used in remote script.

The usage of these parameters can be seen in this example under the tabs ASP.NET, PHP & Java: https://paramquery.com/pro/demos/export. Only difference is that in this example xlsx file is returned back to the client ( browser ) while in your case you need to replace original file with new file on the server itself.

Please let me know if you need further assistance.
« Last Edit: November 18, 2022, 06:53:14 am by paramvir »