diff --git a/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/google-sheets-input.adoc b/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/google-sheets-input.adoc index ede552409dd..72f59c8cb3b 100644 --- a/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/google-sheets-input.adoc +++ b/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/google-sheets-input.adoc @@ -27,7 +27,7 @@ under the License. The Google Sheets Input transform reads data from a Google Sheets worksheets. -This transform requires a Google service account (JSON file) and a Google Cloud project with the Sheets API enabled. +This transform requires a Google service account (JSON file) and a Google Cloud project with the Google Drive and Google Sheets API enabled. | == Supported Engines @@ -44,13 +44,26 @@ This transform requires a Google service account (JSON file) and a Google Cloud === Service account tab -Click the `browse` button to pick your google service account client secret json file. -The `Test` button Lets you test your access to the API. On success, you should see a success message. +[%header, width="90%", cols="1,4"] +|=== +|option|description +|JSON credential key file|Lets you specify or browse for spreadsheets existing in the service account drive or for the ones that are shared with the service account email. +|Application Name|Your application name for the service account in the Google Developer Console. +|Timeout|lets you specify an https timeout (in minutes, defaults to 5). +|Impersonation|lets you impersonate your service account. Check the https://cloud.google.com/iam/docs/impersonating-service-accounts[Google docs] for more information. +|=== + +Click the `Test Connection` button to verify your specified JSON credential key file for your service account can use the Google Drive and Spreadsheets APIs and has access to your Google Spreadsheets. On success, you will see a `Google Drive API: Success!` message. === Spreadsheet tab -Lets you specify or browse for spreadsheets existing in the service account drive or for the ones that are shared with the service account email. +[%header, width="90%", cols="1,4"] +|=== +|option|description +|Spreadsheet Key|specify the key for the Google Spreadsheet you want to read from. Click the "Browse" button to get a list of available spreadsheets. +|Worksheet Id|specify the worksheet id (title) for the sheet in your Google Spreadsheet you want to read from. Click the "Browse" button to get the list of available worksheets in the selected Google Spreadsheet. +|=== === Fields tab diff --git a/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/google-sheets-output.adoc b/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/google-sheets-output.adoc index 5e2018fa3c9..566a28beb8a 100644 --- a/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/google-sheets-output.adoc +++ b/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/google-sheets-output.adoc @@ -27,7 +27,7 @@ under the License. The Google Sheets Output transform writes data to a Google Sheets worksheets. -This transform requires a Google service account (JSON file) and a Google Cloud project with the Sheets API enabled. +This transform requires a Google service account (JSON file) and a Google Cloud project with the Google Drive and Google Sheets API enabled. | == Supported Engines @@ -44,15 +44,24 @@ This transform requires a Google service account (JSON file) and a Google Cloud === Service account tab -Click the `browse` button to pick your google service account client secret json file. -The `Test` button Lets you test your access to the API. On success, you should see a success message. +[%header, width="90%", cols="1,4"] +|=== +|option|description +|JSON credential key file|Lets you specify or browse for spreadsheets existing in the service account drive or for the ones that are shared with the service account email. +|Application Name|Your application name for the service account in the Google Developer Console. +|Timeout|lets you specify an https timeout (in minutes, defaults to 5). +|Impersonation|lets you impersonate your service account. Check the https://cloud.google.com/iam/docs/impersonating-service-accounts[Google docs] for more information. +|=== + +Click the `Test Connection` button to verify your specified JSON credential key file for your service account can use the Google Drive and Spreadsheets APIs and has access to your Google Spreadsheets. On success, you will see a `Google Drive API: Success!` message. + === Spreadsheet tab -[%header, width="90%"] +[%header, width="90%", cols="1,4"] |=== -|Option|Description +|option|description |Spreadsheet key|Lets you specify or browse for spreadsheets existing in the service account drive or for the ones that are shared with the service account email. If you type in a sheet name (that does not exist in the drive) it will attempt to create a sheet it the "create" checkbox is ticked. |Worksheet Id|Should be browsed form the selected spreadsheet key. If you want to create a new file, type in any key that will become the name of the worksheet in the created spreadsheet |Append to sheet|Appends the lines **without the header** to an existing spreadsheet. This is incompatible with the create option below. diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputDialog.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputDialog.java index f750dd3c16b..fdf90c39926 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputDialog.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputDialog.java @@ -786,7 +786,7 @@ private void getSpreadsheetFields() { // fieldname, int position, int length ) GoogleSheetsInputField sampleInputFields = new GoogleSheetsInputField(); String columnsLetter = getColumnName(j + 1); - logBasic("column:" + Integer.toString(j) + ")" + columnsLetter); + logDebug("column:" + Integer.toString(j) + ")" + columnsLetter); Integer nbSampleFields = Integer.parseInt(variables.resolve(wSampleFields.getText())); String sampleRange = @@ -796,7 +796,7 @@ private void getSpreadsheetFields() { + "2:" + columnsLetter + variables.resolve(wSampleFields.getText()); - logBasic("Guess Fieds : Range : " + sampleRange); + logDebug("Guess Fieds : Range : " + sampleRange); ValueRange sampleResult = service .spreadsheets() @@ -814,7 +814,7 @@ private void getSpreadsheetFields() { && sampleRow.get(0) != null && !sampleRow.get(0).toString().isEmpty()) { String tmp = sampleRow.get(0).toString(); - logBasic(Integer.toString(m) + ")" + tmp.toString()); + logDebug(Integer.toString(m) + ")" + tmp.toString()); tmpSampleColumnValues[m] = tmp; m++; } else { @@ -825,13 +825,27 @@ private void getSpreadsheetFields() { System.arraycopy(tmpSampleColumnValues, 0, sampleColumnValues, 0, m); sampleInputFields.setSamples(sampleColumnValues); sampleInputFields.guess(); - item.setText(2, sampleInputFields.getTypeDesc()); - item.setText(3, sampleInputFields.getFormat()); - item.setText(5, Integer.toString(sampleInputFields.getPrecision())); - item.setText(6, sampleInputFields.getCurrencySymbol()); - item.setText(7, sampleInputFields.getDecimalSymbol()); - item.setText(8, sampleInputFields.getGroupSymbol()); - item.setText(9, sampleInputFields.getTrimTypeDesc()); + if(!StringUtils.isEmpty(sampleInputFields.getTypeDesc())){ + item.setText(2, sampleInputFields.getTypeDesc()); + } + if(!StringUtils.isEmpty(sampleInputFields.getFormat())){ + item.setText(3, sampleInputFields.getFormat()); + } + if(!StringUtils.isEmpty(Integer.toString(sampleInputFields.getPrecision()))){ + item.setText(5, Integer.toString(sampleInputFields.getPrecision())); + } + if(!StringUtils.isEmpty(sampleInputFields.getCurrencySymbol())){ + item.setText(6, sampleInputFields.getCurrencySymbol()); + } + if(!StringUtils.isEmpty(sampleInputFields.getDecimalSymbol())){ + item.setText(7, sampleInputFields.getDecimalSymbol()); + } + if(!StringUtils.isEmpty(sampleInputFields.getGroupSymbol())){ + item.setText(8, sampleInputFields.getGroupSymbol()); + } + if(!StringUtils.isEmpty(sampleInputFields.getTrimTypeDesc())){ + item.setText(9, sampleInputFields.getTrimTypeDesc()); + } } else { item.setText(2, "String"); } diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputMeta.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputMeta.java index 49be2fb5f50..a598f3db4ce 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputMeta.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsInputMeta.java @@ -40,8 +40,7 @@ name = "i18n::GoogleSheetsInput.transform.Name", description = "i18n::GoogleSheetsInput.transform.Name", categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Input", - documentationUrl = - "https://hop.apache.org/manual/latest/pipeline/transforms/googlesheetsinput.html") + documentationUrl = "/pipeline/transforms/google-sheets-input.html") public class GoogleSheetsInputMeta extends BaseTransformMeta { diff --git a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutputMeta.java b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutputMeta.java index e84b138cf1d..5d7db4912d4 100644 --- a/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutputMeta.java +++ b/plugins/tech/google/src/main/java/org/apache/hop/pipeline/transforms/googlesheets/GoogleSheetsOutputMeta.java @@ -36,8 +36,7 @@ name = "i18n::GoogleSheetsOutput.transform.Name", description = "i18n::GoogleSheetsOutput.transform.Name", categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Input", - documentationUrl = - "https://hop.apache.org/manual/latest/pipeline/transforms/googlesheetsoutput.html") + documentationUrl = "/pipeline/transforms/google-sheets-output.html") public class GoogleSheetsOutputMeta extends BaseTransformMeta {