Author Topic: Create an empty spreadsheet  (Read 289 times)

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 132
    • View Profile
Create an empty spreadsheet
« on: February 23, 2024, 08:47:44 pm »
Created a pqGrid and used code below to import a spreadsheet:

        pq.excel.importXl({ url: "https://paramquery.com/pro2/Content/workbook.xlsx" }, function (wb) {
            $("#grid").pqGrid("importWb", { workbook: wb, extraRows: 10, extraCols: 10 });
           $("#grid").pqGrid("hideLoading");
        });

How do I create an empty spreadsheet into my grid without loading an empty xlsx file?  Basically I want to open the grid and it is an empty spreadsheet ready to edit, etc.

SOLVED (See my reply)
« Last Edit: February 23, 2024, 10:09:03 pm by jplevene »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Create an empty spreadsheet
« Reply #1 on: February 23, 2024, 10:10:18 pm »
Empty workbook can be used instead of empty xlsx file and extraRows, extraCols parameters can be used to add empty rows and columns.

Code: [Select]
var wb = {
      sheets: [
        {
          rows: [
          ],         
          columns: [         
          ]
        }
      ]
    }

    //import workbook into the grid.
    grid.importWb({ workbook: wb, extraRows: 20, extraCols: 10 });

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 132
    • View Profile
Re: Create an empty spreadsheet
« Reply #2 on: February 23, 2024, 10:11:57 pm »
I did it by:

Code: [Select]
$("#grid").pqGrid("importWb", { sheet:0, workbook:{sheets:[{}]}, extraRows: 10, extraCols: 10 })