class Crexcel::Worksheet

Overview

TODO Write doc for Worksheet class

Defined in:

crexcel/worksheet.cr

Constant Summary

SUPPORTED_TYPES = {"string" => "s", "int" => "n"}

Instance Method Summary

Instance Method Detail

def get(pos_x : Int32 | Int64, pos_y : Int32 | Int64) #

Fetch the data at the given x, y postition

first_worksheet = workbook.add_worksheet
first_worksheet.write(0, 0, "hello") # Will write "hello" in A1 cell
first_worksheet.get(0, 0)            # => {pos: "A1", value: "hello", type: ""}

[View source]
def get(position : String) : Datum #

Fetch the data at the given string postition

first_worksheet = workbook.add_worksheet
first_worksheet.write(0, 0, "hello") # Will write "hello" in A1 cell
first_worksheet.get("A1")            # => {pos: "A1", value: "hello", type: ""}

[View source]
def name : String #

Get name of the worksheet


[View source]
def write(position : String, str : Int32 | Int64 | Float64 | String, type_req : String) #

Write data in the specified worksheet at specific location You can precise the type you want

first_worksheet = workbook.add_worksheet
first_worksheet.write("A1", "1337", "int") # Will write 1337 as a number

Available types are for now : string, int


[View source]
def write(pos_x : Int32 | Int64, pos_y : Int32 | Int64, str : Int32 | Int64 | Float64 | String, type_req = "") #

Same as other write methods, but location is precised differently

first_worksheet = workbook.add_worksheet
first_worksheet.write(0, 0, "hello") # Will write "hello" in A1 cell

[View source]
def write(position : String, str : Int32 | Int64 | Float64 | String) #

Write data in the specified worksheet at specific location

first_worksheet = workbook.add_worksheet
first_worksheet.write("A1", "Hello world!")
first_worksheet.write("A2", "1337") # Will write 1337 as a string
first_worksheet.write("B1", 1337)   # Will write 1337 as a number

[View source]
def write_row(pos_y : Int32 | Int64, data : Array(Int32 | Int64 | Float64 | String)) #

Will write a row with the provided array of data

first_worksheet = workbook.add_worksheet
first_worksheet.write_row(0, ["hello", "world"]) # Will write "hello" in A1 cell and "world" in A2

[View source]
def write_row(row : String, data : Array(Int32 | Int64 | Float64 | String)) #

Will write a row with the provided array of data

first_worksheet = workbook.add_worksheet
first_worksheet.write_row("A", ["hello", "world"]) # Will write "hello" in A1 cell and "world" in A2

[View source]