0

I was having trouble looking for ways to create and modify checkboxes in Google Spreadsheet using Java.

I have looked through the Google API documentation and only found some Javascript APIS that could do that. The worst case is to use javax.script package to convert Javascript into java, however, that is the last thing I wish to do.

1 Answers1

0

Never mind, I have already found the solution. Basically I will have to use setCondition to create checkboxes.

 requests.add(new Request().setRepeatCell(new RepeatCellRequest()
                .setCell(new CellData()  // set Cell 
                        .setDataValidation(new DataValidationRule().setCondition(new BooleanCondition().setType("BOOLEAN")))) 
                .setRange(new GridRange()   // Set Range
                        .setSheetId(0)    // sheet number see URL 
                        .setStartRowIndex(1)   // starting row index
                        .setEndRowIndex(10)     // ending row index
                        .setStartColumnIndex(5)   // starting column Index
                        .setEndColumnIndex(7))    // ending column index   
                .setFields("DataValidation")      
        ));