beregabor / gsheetsender Goto Github PK
View Code? Open in Web Editor NEWSimple tool to send Google Sheet data in HTML email.
License: GNU General Public License v2.0
Simple tool to send Google Sheet data in HTML email.
License: GNU General Public License v2.0
After named_ranges and cell_values option added to email_config.json, the range argument is not necessary any more.
Remove the arg, and change template sample, to use only named_ranges and cell_values.
Add input validation to email_config.json fields:
Input validation run before core business logic execution. Implement in separated class.
Refact and add unit tests.
Separate hard dependencies from logic in different classes.
Public google sheet to unit tests.
Add multi_range option to email_config json to add more range data read from.
named_ranges option values separete with , char.
A range syntax: [range_name]=[Sheet]![LeftTopCell]:[RightBottomCell]
The script add the multi_range dict to template rendering.
template.render(values=table_content, named_ranges=named_range_dict)
The dict will contain the values under range_name keys in dict.
named_range sample in json:
{ "template_dir": "/tmp/template", "send_from": "[email protected]", "send_to": "[email protected]", "subject": "Test mail", "add_attachment": false, "attachment_file_name": "release_plan.xlsx", "named_ranges": "customer_name=Sheet1!A1:A1,orders=Orders!A3:D" }
this sample will read 2 ranges:
From template this values can use as:
{{named_ranges.customer_name[0][0]}}
{% for order in named_ranges.orders %}
{{order[0]}}
{{order[1]}}
{{order[2]}}
Add cell_values option to email_config json
syntax:
"cell_values": "value_name=Sheet1!A1,value2=Sheet1!C3"
A cell value definition syntax: [name]=[sheet_name]![Cell]
The cell values definitions are separate with ,
The script add the cell_values dict to template rendering.
template.render(values=table_content, cell_values=cell_values_dict)
The dict will contain the cell values under the cell_name key.
The script read cell values from sheet, and use this values in template rendering.
From template can use cell_values (as example above):
{{cell_values.value_name}}
{{cell_values.value2}}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.