I'm trying to create a spreadsheet which have 4 sheets and some format. I read the document of Google and knew that we can use method spreadsheets.create to do this. I made a json request body to test this API and it work but I don't know how to send this json in PHP. This is my json string, you can test it in the Google Spreadsheet API document: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/create
{
"properties": {
"title": "Dự toán",
"defaultFormat": {
"verticalAlignment": "MIDDLE",
"wrapStrategy": "WRAP",
"textFormat": {
"fontFamily": "Arial",
"fontSize": 12
}
}
},
"sheets": [
{
"properties": {
"sheetId": 0,
"index": 0,
"title": "CP Xây lắp"
},
"merges": [
{
"sheetId": 0,
"startColumnIndex": 0,
"endColumnIndex": 5,
"startRowIndex": 0,
"endRowIndex": 1
},
{
"sheetId": 0,
"startColumnIndex": 0,
"endColumnIndex": 5,
"startRowIndex": 2,
"endRowIndex": 3
},
{
"sheetId": 0,
"startColumnIndex": 0,
"endColumnIndex": 5,
"startRowIndex": 3,
"endRowIndex": 4
},
{
"sheetId": 0,
"startColumnIndex": 0,
"endColumnIndex": 5,
"startRowIndex": 4,
"endRowIndex": 5
}
],
"data": [
{
"startRow": 0,
"startColumn": 0,
"rowData": [
{
"values": [
{
"userEnteredValue": {
"stringValue": "BẢNG TỔNG HỢP CHI PHÍ XÂY LẮP"
},
"userEnteredFormat": {
"horizontalAlignment": "CENTER"
}
}
]
},
{
"values": [
{}
]
},
{
"values": [
{
"userEnteredValue": {
"stringValue": "CÔNG TRÌNH: "
},
"userEnteredFormat": {
"horizontalAlignment": "CENTER",
"textFormat": {
"bold": true
}
}
}
]
},
{
"values": [
{
"userEnteredValue": {
"stringValue": "HẠNG MỤC: "
},
"userEnteredFormat": {
"horizontalAlignment": "CENTER",
"textFormat": {
"bold": true
}
}
}
]
},
{
"values": [
{
"userEnteredValue": {
"stringValue": "ĐỊA ĐIỂM: "
},
"userEnteredFormat": {
"horizontalAlignment": "CENTER",
"textFormat": {
"bold": true
}
}
}
]
}
],
"rowMetadata": [
{}
],
"columnMetadata": [
{}
]
}
]
}
]
}
Could somebody help me please ^^