Sheets API v4 is returning #N/A when using vlookup formula. This specific error is happening with vlookup formula, but I have seen this very same issue on spreadsheets contains a big number of formulas. Seems like the API does not wait for the spreadsheet to calculate formulas before returning the values.
A small code sample in python:
service.spreadsheets().values().get(
spreadsheetId='1s-fePyrjzp8_jAWy-p1smystgJXxMirmjXGJjQM91qg',
range="FxRates salaries filter!A1:D5",
valueRenderOption="UNFORMATTED_VALUE",
dateTimeRenderOption="SERIAL_NUMBER"
).execute()
Steps will reproduce the problem?
- Create a vlookup formula on a Google Spreadsheet
- Use Sheets API to get the result of the formula
Expected output: The expected output is a number, but instead, the API is returning "#N/A (Did not find value '43531' in VLOOKUP evaluation.)". The spreadsheet itself calculates the formula correctly, but the API returns #N/A
You can easily reproduce the problem on API Explorer by executing the link below: Google Sheets API Explorer