所以,我有一個靜態資料匯出檔案,它只能作為 .YAML 檔案使用。它非常大,所以這里有一段代碼供您了解它的外觀:
2047:
activities:
copying:
time: 720
invention:
materials:
- quantity: 2
typeID: 20416
- quantity: 2
typeID: 20415
products:
- probability: 0.34
quantity: 10
typeID: 2049
skills:
- level: 1
typeID: 11529
- level: 1
typeID: 11442
- level: 1
typeID: 23121
time: 13800
manufacturing:
materials:
- quantity: 1062
typeID: 34
- quantity: 2
typeID: 35
- quantity: 53
typeID: 36
products:
- quantity: 1
typeID: 2046
skills:
- level: 1
typeID: 3380
time: 900
research_material:
time: 315
research_time:
time: 315
blueprintTypeID: 2047
maxProductionLimit: 200
26407:
activities:
copying:
materials:
- quantity: 10
typeID: 3812
skills:
- level: 1
typeID: 26260
time: 36000
manufacturing:
materials:
- quantity: 24
typeID: 25617
- quantity: 35
typeID: 25619
- quantity: 1
typeID: 11486
- quantity: 27
typeID: 25607
products:
- quantity: 1
typeID: 26406
skills:
- level: 5
typeID: 3380
- level: 1
typeID: 11449
- level: 1
typeID: 11452
- level: 1
typeID: 26260
time: 45000
research_material:
skills:
- level: 5
typeID: 3409
- level: 1
typeID: 26260
time: 15750
research_time:
skills:
- level: 5
typeID: 3403
- level: 1
typeID: 26260
time: 15750
blueprintTypeID: 26407
maxProductionLimit: 1
31705:
activities:
copying:
time: 1200
invention:
materials:
- quantity: 1
typeID: 20424
- quantity: 1
typeID: 20423
products:
- probability: 0.34
quantity: 1
typeID: 31711
skills:
- level: 1
typeID: 11451
- level: 1
typeID: 11452
- level: 1
typeID: 21791
time: 7200
manufacturing:
materials:
- quantity: 2
typeID: 25593
- quantity: 4
typeID: 25601
- quantity: 3
typeID: 25599
products:
- quantity: 1
typeID: 31704
skills:
- level: 1
typeID: 3380
- level: 1
typeID: 26257
time: 1500
research_material:
skills:
- level: 1
typeID: 3409
- level: 1
typeID: 26257
time: 525
research_time:
skills:
- level: 1
typeID: 3403
- level: 1
typeID: 26257
time: 525
blueprintTypeID: 31705
maxProductionLimit: 100
我想將該資料轉換為 Google Sheets 表格,但是我遇到了一個問題:我無法使用 Google Sheets 中的“匯入”功能來使用 .YAML 檔案,因為不支持 .YAML 檔案。
我嘗試了 20 多種不同的在線轉換器,還嘗試將 .YAML 轉換為 .CSV、.HTML 和其他符合 Google 表格匯入條件的檔案型別,但它要么不適用于如此大的檔案,要么結果表是缺少一半的內容,原始資料和列之間的資料放置不正確。
For now, I don't even think about formatting the data and how do I want the resulting table to look like. I only want to somehow transform that .YAML into a properly working Google Sheet table which is not missing any data.
Please, advise me how would you solve that issue.
P.S.: Also, please keep in your mind that I am absolute 0 to programming, the only thing I can do is copy-paste the code into Google Scripts attached to the Google Sheet and then invoke the containing function. If your solution works separately from GSheets and GScripts environment, please, also advise the actual way how a lamer like me can use it.
uj5u.com熱心網友回復:
將 YAML 轉換為 JSON
這是轉換為 JSON 的資料。
{
"2047": {
"activities": {
"copying": {
"time": 720
},
"invention": {
"materials": [
{
"quantity": 2,
"typeID": 20416
},
{
"quantity": 2,
"typeID": 20415
}
],
"products": [
{
"probability": 0.34,
"quantity": 10,
"typeID": 2049
}
],
"skills": [
{
"level": 1,
"typeID": 11529
},
{
"level": 1,
"typeID": 11442
},
{
"level": 1,
"typeID": 23121
}
],
"time": 13800
},
"manufacturing": {
"materials": [
{
"quantity": 1062,
"typeID": 34
},
{
"quantity": 2,
"typeID": 35
},
{
"quantity": 53,
"typeID": 36
}
],
"products": [
{
"quantity": 1,
"typeID": 2046
}
],
"skills": [
{
"level": 1,
"typeID": 3380
}
],
"time": 900
},
"research_material": {
"time": 315
},
"research_time": {
"time": 315
}
},
"blueprintTypeID": 2047,
"maxProductionLimit": 200
},
"26407": {
"activities": {
"copying": {
"materials": [
{
"quantity": 10,
"typeID": 3812
}
],
"skills": [
{
"level": 1,
"typeID": 26260
}
],
"time": 36000
},
"manufacturing": {
"materials": [
{
"quantity": 24,
"typeID": 25617
},
{
"quantity": 35,
"typeID": 25619
},
{
"quantity": 1,
"typeID": 11486
},
{
"quantity": 27,
"typeID": 25607
}
],
"products": [
{
"quantity": 1,
"typeID": 26406
}
],
"skills": [
{
"level": 5,
"typeID": 3380
},
{
"level": 1,
"typeID": 11449
},
{
"level": 1,
"typeID": 11452
},
{
"level": 1,
"typeID": 26260
}
],
"time": 45000
},
"research_material": {
"skills": [
{
"level": 5,
"typeID": 3409
},
{
"level": 1,
"typeID": 26260
}
],
"time": 15750
},
"research_time": {
"skills": [
{
"level": 5,
"typeID": 3403
},
{
"level": 1,
"typeID": 26260
}
],
"time": 15750
}
},
"blueprintTypeID": 26407,
"maxProductionLimit": 1
},
"31705": {
"activities": {
"copying": {
"time": 1200
},
"invention": {
"materials": [
{
"quantity": 1,
"typeID": 20424
},
{
"quantity": 1,
"typeID": 20423
}
],
"products": [
{
"probability": 0.34,
"quantity": 1,
"typeID": 31711
}
],
"skills": [
{
"level": 1,
"typeID": 11451
},
{
"level": 1,
"typeID": 11452
},
{
"level": 1,
"typeID": 21791
}
],
"time": 7200
},
"manufacturing": {
"materials": [
{
"quantity": 2,
"typeID": 25593
},
{
"quantity": 4,
"typeID": 25601
},
{
"quantity": 3,
"typeID": 25599
}
],
"products": [
{
"quantity": 1,
"typeID": 31704
}
],
"skills": [
{
"level": 1,
"typeID": 3380
},
{
"level": 1,
"typeID": 26257
}
],
"time": 1500
},
"research_material": {
"skills": [
{
"level": 1,
"typeID": 3409
},
{
"level": 1,
"typeID": 26257
}
],
"time": 525
},
"research_time": {
"skills": [
{
"level": 1,
"typeID": 3403
},
{
"level": 1,
"typeID": 26257
}
],
"time": 525
}
},
"blueprintTypeID": 31705,
"maxProductionLimit": 100
}
}
- 轉換工具
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/438814.html
標籤:google-sheets type-conversion yaml
