Need a way to filter everything but embeded column row

Posted by: georgeg on 24 July 2025, 1:45 pm EST

  • Posted 24 July 2025, 1:45 pm EST - Updated 24 July 2025, 1:51 pm EST

    Because I am no longer adding data to the sheet via:

    sheet.setDataSource(data[i].data);

    and adding the data manually… is there a way to filter everything but the column headers that I have stuck in the sheet?

    The popup window includes the the first row which is the header… which is expected…I guess.

    Is there a way to not include the first header row.

    Here is basically how I am populating the sheet from data in an HTTP request (GET|POST)

    //PUT COLUMN NAME in first row:
                        sheet.name("Queue Data Report");
                        // Clear the sheet first
                         sheet.clear();
                        // Get column names from the first object in your JSON array
                        const columnNames = Object.keys(spreadJsData[0]);
                        // Write column names into row 0
                        columnNames.forEach((colName, colIndex) => {
                            sheet.setValue(0, colIndex, colName); // Row 0, Column colIndex
                        });
                        // Write data starting from row 1
                        spreadJsData.forEach((rowData, rowIndex) => {
                            columnNames.forEach((colName, colIndex) => {
                                sheet.setValue(rowIndex + 1, colIndex, rowData[colName]); // Row starts at 1
                            });
                        });
                        sheet.options.protectionOptions = {
                            allowResizeColumns: true
                        };
                        // Lock specific columns (e.g., first 6)
                        sheet.options.isProtected = true;
                        sheet.getRange(-1, -1, -1, -1).locked(false); // Unlock all first
                        for (let i = 0; i < columnNames.length; i++) {
                            if (i < 6) {
                                sheet.getRange(-1, i, -1, 1).locked(true);
                            }
                        }
                        // Lock last column
                        sheet.getRange(-1, columnNames.length - 1, -1, 1).locked(true);
    
    
                        // Auto-fit columns
                        for (let j = 0; j < columnNames.length; j++) {
                            sheet.autoFitColumn(j);
                            let columnWidth = Math.max(sheet.getColumnWidth(j), columnNames[j].length * 10);
                            sheet.setColumnWidth(j, columnWidth);
                            //Also alow resizing of columns:
                            sheet.setColumnResizable(j, true);
                        }
                        sheet.options.colHeaderVisible = true;
    
                        // Resume painting
                        spread.resumeEvent();
                        spread.resumePaint();
    
  • Posted 25 July 2025, 6:50 am EST

    Hi,

    As I understand, you’re manually adding data to the sheet, with the first row being used as the header, but it’s also getting included in the filter.

    From the image, it appears that the filter is being applied to the entire range including the header row, which is why it shows up in the filter options and gets filtered as well. To prevent this, you can define a specific filter range using the rowFilter method, which allows you to exclude the header row.

    Refer to the snippet below and the attached “Sample.zip” for reference:

    // Apply filter excluding the first row
    sheet.rowFilter(new GC.Spread.Sheets.Filter.HideRowFilter(
        new GC.Spread.Sheets.Range(1, 0, 6, 3)
    ));

    Sample: Sample.zip

    References:

    Regards,

    Priyam

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels