Created
January 5, 2018 19:04
-
-
Save lporras/ee1305ce6ea02ece2ebc7d83b2d2d345 to your computer and use it in GitHub Desktop.
DataValidation Example with write_xlsx Gem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'write_xlsx' | |
workbook = WriteXLSX.new('write_xlsx_example.xlsx') | |
dropdownSheet = workbook.add_worksheet('DropDown Values') | |
dropdownSheet.write_row(0,0,['open', 'high', 'close']) | |
dropdownSheet.protect('password') | |
worksheet = workbook.add_worksheet | |
worksheet.data_validation('A1:A100', | |
{ | |
:validate => 'list', | |
#:value => ['open', 'high', 'close'], | |
:value => "'DropDown Values'!A$1:C$1", | |
#:input_title => 'Input an integer:', | |
:input_message => 'Choose the value from the dropdown', | |
:error_message => 'Please use the dropdown selector to choose the value' | |
}) | |
dropdownSheet.hide | |
worksheet.set_first_sheet | |
worksheet.activate | |
workbook.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment