Comments (1)
ダウンロード用、GAS
// https://stackoverflow.com/a/28711961
function export_sheets_as_csv_to_folder() {
// Sheet id is in URL https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID/edit#gid=IGNORE
var ss = SpreadsheetApp.openById('xxxxxxxxxxxxxxxxxxxxxxxx');
var sheets = ss.getSheets();
if (sheets === undefined || sheets.length === 0) {
return;
}
var passThroughFolder = DriveApp.createFolder('suito_data');
for (var s in sheets) {
Logger.log(sheets[s].getName());
var csv = convertRangeToCsvFile_(sheets[s])
Logger.log(csv);
passThroughFolder.createFile(sheets[s].getName() + ".tsv", csv);
}
}
// https://gist.github.com/mrkrndvs/a2c8ff518b16e9188338cb809e06ccf1
function convertRangeToCsvFile_(sheet) {
// get available data range in the spreadsheet
var activeRange = sheet.getDataRange();
try {
var data = activeRange.getValues();
var csvFile = undefined;
// loop through the data in the range and build a string with the csv data
if (data.length > 1) {
var csv = "";
for (var row = 0; row < data.length; row++) {
for (var col = 0; col < data[row].length; col++) {
// If the data is a date, convert it to a string in 'YYYY-MM-DD' format.
if (data[row][col] instanceof Date) {
var year = data[row][col].getFullYear();
var month = ("0" + (data[row][col].getMonth() + 1)).slice(-2);
var day = ("0" + data[row][col].getDate()).slice(-2);
data[row][col] = `${year}-${month}-${day}`;
}
if (data[row][col].toString().indexOf("\t") != -1) {
data[row][col] = "\"" + data[row][col] + "\"";
}
}
// join each row's columns
// add a carriage return to end of each row, except for the last one
if (row < data.length-1) {
csv += data[row].join("\t") + "\r\n";
}
else {
csv += data[row].join("\t") ;
}
}
csvFile = csv;
}
return csvFile;
}
catch(err) {
Logger.log(err);
Browser.msgBox(err);
}
}
from suito.
Related Issues (20)
- [Mobile] [Test] トランザクション削除 テスト追加
- [Mobile][Test] トランザクション登録ロジックテスト追加
- [Mobile] トランザクション一覧 ロジックテスト追加
- [Mobile] [Test] スケジュール一覧 ロジックテスト追加
- [Mobile] [Test] トランザクションUIテスト追加
- [Mobile] [Test] トランザクション 月選択UIテスト追加
- [Mobile] [Test] 支出詳細UIテスト追加
- [Mobile] [Test] 収入詳細UIテスト追加
- [Mobile] トランザクション詳細の未入力状態が判別しにくい
- [Mobile] アカウントページへの導線を追加
- [Mobile] CIのテスト実行環境をubuntuに変更する
- [Mobile] トランザクション メモUIテスト追加
- [Mobile] トランザクション詳細遷移ロジック見直し
- [Mobile] トランザクション 日付選択UIテスト追加
- [Mobile] [Test] 支出スケジュール詳細UIテスト追加
- [Mobile] [Test] 収入スケジュール詳細UIテスト追加
- [Mobile] [Test] スケジュール一覧UIテスト追加
- [Mobile] [Test] 棒グラフ ロジックテスト追加
- [Mobile] [Test] 円グラフロジックテスト追加
- [Mobile] [テスト] チャート画面 UIテスト追加
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from suito.