import { getColumnNames } from "./getColumnNames" ; import { getSetIdForSyncing } from "./getSetIdForSyncing" ; import { getColumnPositionByName } from "./getColumnPositionByName" ; import { getCurrentValueByColumnName } from "./getCurrentValueByColumnName" ; import { convertColumnPositionToLetter } from "./convertColumnPositionToLetter" ; import { areDefinitionsTheSame } from "./areDefinitionsTheSame" ; import { Vocabulary } from "@ulangi/ulangi-common/interfaces" ; import { DeepPartial } from "@ulangi/extended-types" ; import { convertVocabularyListToRows } from "./convertVocabularyListToRows" ; export function updateRows ( sheet , vocabularySetIdPairs ) { const columnNames = getColumnNames ( ) ; const rowIndexValuesPairs = convertVocabularyListToRows ( vocabularySetIdPairs , sheet ) ; let lastRow = sheet . getLastRow ( ) ; rowIndexValuesPairs . forEach ( ( [ rowIndex , values ] ) : void => { if ( typeof rowIndex === "undefined" ) { ++ lastRow ; } const targetRowIndex = typeof rowIndex !== "undefined" ? rowIndex : lastRow ; values [ values . length - 1 ] = `=ISEDITED(A${ targetRowIndex }:${ convertColumnPositionToLetter ( columnNames . length - 1 ) }${ targetRowIndex })` ; sheet . getRange ( targetRowIndex , 1 , 1 , columnNames . length ) . setValues ( [ values ] ) ; } ) ; }