Home > Mobile >  spreadsheet API multiply two columns and write the results as another column with python
spreadsheet API multiply two columns and write the results as another column with python

Time:10-06

I'm trying to multiply C and E columns and write the results to the G column but I couldn't figure it out. Do you have any idea how I can do that?

request_body ={
  "requests": [
    {
      "repeatCell": {
        "range": {
          "sheetId": spreadsheetId,
          "startRowIndex": 2,
          "endRowIndex": 15,
          "startColumnIndex": 7,
          "endColumnIndex": 8
        },
        "cell": {
          "userEnteredValue": {
              "formulaValue": "=FLOOR(E2*C2)"
          }
        },
        "fields": "userEnteredValue"
      }
    }
  ]
}


response = serviceSheets.spreadsheets().values().update(
spreadsheetId=spreadsheetId,
body=request_body
).execute()

CodePudding user response:

The issue in your code is that you are using enter image description here

  • Since I used endRowIndex = 15, Cell H16 formula was not set.
  • Related